From fb4113dab4df8480c77bdcb707fa6b5408755b79 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 29 Oct 2014 10:34:40 +0100 Subject: PoC 7 updates * Bloom * Block restructure * Receipts --- ethutil/rlp.go | 6 ++++++ ethutil/value.go | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'ethutil') diff --git a/ethutil/rlp.go b/ethutil/rlp.go index 55406133b..1fff2b28a 100644 --- a/ethutil/rlp.go +++ b/ethutil/rlp.go @@ -15,6 +15,10 @@ type RlpEncodeDecode interface { RlpValue() []interface{} } +type RlpEncodable interface { + RlpData() interface{} +} + func Rlp(encoder RlpEncode) []byte { return encoder.RlpEncode() } @@ -100,6 +104,8 @@ func Encode(object interface{}) []byte { switch t := object.(type) { case *Value: buff.Write(Encode(t.Raw())) + case RlpEncodable: + buff.Write(Encode(t.RlpData())) // Code dup :-/ case int: buff.Write(Encode(big.NewInt(int64(t)))) diff --git a/ethutil/value.go b/ethutil/value.go index dd777fa43..6417b0008 100644 --- a/ethutil/value.go +++ b/ethutil/value.go @@ -377,6 +377,10 @@ func (val *Value) NewIterator() *ValueIterator { return &ValueIterator{value: val} } +func (it *ValueIterator) Len() int { + return it.value.Len() +} + func (it *ValueIterator) Next() bool { if it.idx >= it.value.Len() { return false -- cgit