mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
trie: don't crash for invalid proof (needs investigation)
This commit is contained in:
parent
cc860e38e5
commit
df0056c1dc
1 changed files with 3 additions and 2 deletions
|
|
@ -125,7 +125,7 @@ func VerifyProof(rootHash common.Hash, key []byte, proof []rlp.RawValue) (value
|
|||
}
|
||||
|
||||
func get(tn node, key []byte) ([]byte, node) {
|
||||
for len(key) > 0 {
|
||||
for {
|
||||
switch n := tn.(type) {
|
||||
case *shortNode:
|
||||
if len(key) < len(n.Key) || !bytes.Equal(n.Key, key[:len(n.Key)]) {
|
||||
|
|
@ -140,9 +140,10 @@ func get(tn node, key []byte) ([]byte, node) {
|
|||
return key, n
|
||||
case nil:
|
||||
return key, nil
|
||||
case valueNode:
|
||||
return nil, n
|
||||
default:
|
||||
panic(fmt.Sprintf("%T: invalid node: %v", tn, tn))
|
||||
}
|
||||
}
|
||||
return nil, tn.(valueNode)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue