Make CreateSignature byte oriented

This commit is contained in:
Kovid Goyal 2023-07-02 22:08:22 +05:30
parent 71a1050b9f
commit c28f6a7bf4
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 30 additions and 14 deletions

View file

@ -86,12 +86,12 @@ type BlockHash struct {
WeakHash uint32
}
func (self BlockHash) Serialize() string {
func (self BlockHash) Serialize() []byte {
ans := make([]byte, 12+len(self.StrongHash))
bin.PutUint64(ans, self.Index)
bin.PutUint32(ans[8:], self.WeakHash)
copy(ans[12:], self.StrongHash)
return utils.UnsafeBytesToString(ans)
return ans
}
func (self BlockHash) Unserialize(data []byte, hash_size int) (err error) {