From 8743cc1c1ce6b78a02cd29cc06eed3a85ea74209 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 27 Jun 2015 04:26:26 +0200 Subject: [PATCH] rlp: add ListSize --- rlp/encode.go | 6 ++++++ 1 file changed, 6 insertions(+) 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.