aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/decode.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2014-12-30 18:40:32 +0800
committerFelix Lange <fjl@twurst.com>2015-01-15 18:00:19 +0800
commit552f5b2693a5d19c126a8116d36ba1f4f6cb76a1 (patch)
treea28efc122113ab7bb48df40ad3215af304cada2c /rlp/decode.go
parentbb55307a9d8fa73b0fbc0727f8b80925a87627b7 (diff)
downloadgo-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.tar
go-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.tar.gz
go-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.tar.bz2
go-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.tar.lz
go-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.tar.xz
go-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.tar.zst
go-tangerine-552f5b2693a5d19c126a8116d36ba1f4f6cb76a1.zip
rlp: add functions for encoding
I'm reasonably confident that the encoding matches the output of ethutil.Encode for values that it supports. Some of the tests have been adpated from the Ethereum testing repository. There are still TODOs in the code.
Diffstat (limited to 'rlp/decode.go')
-rw-r--r--rlp/decode.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/rlp/decode.go b/rlp/decode.go
index a2bd04285..972e662c2 100644
--- a/rlp/decode.go
+++ b/rlp/decode.go
@@ -329,15 +329,9 @@ type field struct {
}
func makeStructDecoder(typ reflect.Type) (decoder, error) {
- var fields []field
- for i := 0; i < typ.NumField(); i++ {
- if f := typ.Field(i); f.PkgPath == "" { // exported
- info, err := cachedTypeInfo1(f.Type)
- if err != nil {
- return nil, err
- }
- fields = append(fields, field{i, info})
- }
+ fields, err := structFields(typ)
+ if err != nil {
+ return nil, err
}
dec := func(s *Stream, val reflect.Value) (err error) {
if _, err = s.List(); err != nil {