aboutsummaryrefslogtreecommitdiffstats
path: root/trie/proof.go
diff options
context:
space:
mode:
Diffstat (limited to 'trie/proof.go')
-rw-r--r--trie/proof.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/trie/proof.go b/trie/proof.go
index 1f8f76b1b..298f648c4 100644
--- a/trie/proof.go
+++ b/trie/proof.go
@@ -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)
}