mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
trie/proof: remove dupl check in resolving nodes
This commit is contained in:
parent
9298074633
commit
ca142eb29a
1 changed files with 5 additions and 7 deletions
|
|
@ -518,7 +518,7 @@ func VerifyRangeProof(rootHash common.Hash, firstKey []byte, keys [][]byte, valu
|
||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
var lastKey = keys[len(keys)-1]
|
lastKey := keys[len(keys)-1]
|
||||||
// Special case, there is only one element and two edge keys are same.
|
// Special case, there is only one element and two edge keys are same.
|
||||||
// In this case, we can't construct two edge paths. So handle it here.
|
// In this case, we can't construct two edge paths. So handle it here.
|
||||||
if len(keys) == 1 && bytes.Equal(firstKey, lastKey) {
|
if len(keys) == 1 && bytes.Equal(firstKey, lastKey) {
|
||||||
|
|
@ -592,15 +592,9 @@ func get(tn node, key []byte, skipResolved bool) ([]byte, node) {
|
||||||
}
|
}
|
||||||
tn = n.Val
|
tn = n.Val
|
||||||
key = key[len(n.Key):]
|
key = key[len(n.Key):]
|
||||||
if !skipResolved {
|
|
||||||
return key, tn
|
|
||||||
}
|
|
||||||
case *fullNode:
|
case *fullNode:
|
||||||
tn = n.Children[key[0]]
|
tn = n.Children[key[0]]
|
||||||
key = key[1:]
|
key = key[1:]
|
||||||
if !skipResolved {
|
|
||||||
return key, tn
|
|
||||||
}
|
|
||||||
case hashNode:
|
case hashNode:
|
||||||
return key, n
|
return key, n
|
||||||
case nil:
|
case nil:
|
||||||
|
|
@ -610,5 +604,9 @@ func get(tn node, key []byte, skipResolved bool) ([]byte, node) {
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
|
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !skipResolved {
|
||||||
|
return key, tn
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue