Skip to content

Commit 8743cc1

Browse files
fjlobscuren
authored andcommitted
rlp: add ListSize
1 parent a0566c1 commit 8743cc1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎rlp/encode.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ type Encoder interface {
2929
EncodeRLP(io.Writer) error
3030
}
3131

32+
// ListSize returns the encoded size of an RLP list with the given
33+
// content size.
34+
func ListSize(contentSize uint64) uint64 {
35+
return uint64(headsize(contentSize)) + contentSize
36+
}
37+
3238
// Encode writes the RLP encoding of val to w. Note that Encode may
3339
// perform many small writes in some cases. Consider making w
3440
// buffered.

0 commit comments

Comments
 (0)