avoid decode error on storage branch nodes when element won't decode into byte array

This commit is contained in:
Ian Norden
2020-05-12 09:32:33 -05:00
parent bb14c01529
commit 3320df264f
6 changed files with 30 additions and 21 deletions
+2 -2
View File
@@ -138,12 +138,12 @@ func parseTrieNodeExtension(i []interface{}, codec uint64) ([]interface{}, error
func parseTrieNodeBranch(i []interface{}, codec uint64) ([]interface{}, error) {
var out []interface{}
for _, vi := range i {
for i, vi := range i {
v, ok := vi.([]byte)
// Sometimes this throws "panic: interface conversion: interface {} is []interface {}, not []uint8"
// Figure out why, and if it is okay to continue
if !ok {
continue
return nil, fmt.Errorf("unable to decode branch node entry into []byte at position: %d value: %+v", i, vi)
}
switch len(v) {