Encode hashes

This commit is contained in:
Alexey Sharp 2021-07-15 15:48:55 +01:00
parent 0393f29197
commit d5e11f3b2e

View File

@ -20,8 +20,8 @@ import "fmt"
const ParseHashErrorPrefix = "parse hash payload"
// ParseHash extracts the next hash from the RLP encoding (payload) from a given position
// it appends the hash to the given slice, reusing the space if there is enough capacity
// ParseHash extracts the next hash from the RLP encoding (payload) from a given position.
// It appends the hash to the given slice, reusing the space if there is enough capacity
// The first returned value is the slice where hash is appended to.
// The second returned value is the new position in the RLP payload after the extraction
// of the hash.
@ -70,3 +70,11 @@ func ParseHashesCount(payload []byte, pos int) (int, int, error) {
}
return dataLen / 33, dataPos + dataLen, nil
}
// EncodeHashes produces RLP encoding of given number of hashes, as RLP list
// It appends encoding to the given given slice (encodeBuf), reusing the space
// there is there is enough capacity.
// The first returned value is rthe slice where encodinfg
func EncodeHashes(hashes []byte, count int, encodeBuf []byte) ([]byte, error) {
return nil, nil
}