Ignore XXX Fields in XXX SSZ Encoding (#1195)

* ignore XXX fields in struct

* fix encode
This commit is contained in:
Raul Jordan 2018-12-28 23:12:27 -06:00 committed by GitHub
parent 5a50f6c5b6
commit a4e1e8cc08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import (
"io"
"reflect"
"sort"
"strings"
"sync"
)
@ -89,6 +90,9 @@ type field struct {
func sortedStructFields(typ reflect.Type) (fields []field, err error) {
for i := 0; i < typ.NumField(); i++ {
f := typ.Field(i)
if strings.Contains(f.Name, "XXX") {
continue
}
encDec, err := cachedEncoderDecoderNoAcquireLock(f.Type)
if err != nil {
return nil, fmt.Errorf("failed to get encoder/decoder: %v", err)