for some reason every now and then a branch node would throw a panic here; still need to figure out why; quick fix

This commit is contained in:
Ian Norden 2020-03-22 09:05:26 -05:00
parent b2d5345c02
commit f81c440418

View File

@ -56,8 +56,7 @@ func decodeTrieNode(c cid.Cid, b []byte,
err error
)
err = rlp.DecodeBytes(b, &i)
if err != nil {
if err = rlp.DecodeBytes(b, &i); err != nil {
return nil, err
}
@ -140,7 +139,12 @@ func parseTrieNodeBranch(i []interface{}, codec uint64) ([]interface{}, error) {
var out []interface{}
for _, vi := range i {
v := vi.([]byte)
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
}
switch len(v) {
case 0: