aboutsummaryrefslogtreecommitdiffstats
path: root/rlp
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-06-27 10:26:26 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-06-30 00:51:48 +0800
commit8743cc1c1ce6b78a02cd29cc06eed3a85ea74209 (patch)
tree7e85effa55ae199c7ed96040a2e7960d46b55d19 /rlp
parenta0566c10585cd19b12b40127597e310f4b7bfa67 (diff)
downloadgo-tangerine-8743cc1c1ce6b78a02cd29cc06eed3a85ea74209.tar.gz
go-tangerine-8743cc1c1ce6b78a02cd29cc06eed3a85ea74209.tar.zst
go-tangerine-8743cc1c1ce6b78a02cd29cc06eed3a85ea74209.zip
rlp: add ListSize
Diffstat (limited to 'rlp')
-rw-r--r--rlp/encode.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/rlp/encode.go b/rlp/encode.go
index a9f80d448..b418fb501 100644
--- a/rlp/encode.go
+++ b/rlp/encode.go
@@ -29,6 +29,12 @@ type Encoder interface {
EncodeRLP(io.Writer) error
}
+// ListSize returns the encoded size of an RLP list with the given
+// content size.
+func ListSize(contentSize uint64) uint64 {
+ return uint64(headsize(contentSize)) + contentSize
+}
+
// Encode writes the RLP encoding of val to w. Note that Encode may
// perform many small writes in some cases. Consider making w
// buffered.