Skip to content

Commit 4255d80

Browse files
rjl493456442jagdeep sidhu
authored andcommitted
trie: fix range prover (ethereum#24266)
1 parent 05daf3b commit 4255d80

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

trie/proof.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error
406406
}
407407

408408
// hasRightElement returns the indicator whether there exists more elements
409-
// in the right side of the given path. The given path can point to an existent
409+
// on the right side of the given path. The given path can point to an existent
410410
// key or a non-existent one. This function has the assumption that the whole
411411
// path should already be resolved.
412412
func hasRightElement(node node, key []byte) bool {
@@ -505,7 +505,7 @@ func VerifyRangeProof(rootHash common.Hash, firstKey []byte, lastKey []byte, key
505505
if val != nil || hasRightElement(root, firstKey) {
506506
return false, errors.New("more entries available")
507507
}
508-
return hasRightElement(root, firstKey), nil
508+
return false, nil
509509
}
510510
// Special case, there is only one element and two edge keys are same.
511511
// In this case, we can't construct two edge paths. So handle it here.
@@ -563,7 +563,7 @@ func VerifyRangeProof(rootHash common.Hash, firstKey []byte, lastKey []byte, key
563563
if tr.Hash() != rootHash {
564564
return false, fmt.Errorf("invalid proof, want hash %x, got %x", rootHash, tr.Hash())
565565
}
566-
return hasRightElement(root, keys[len(keys)-1]), nil
566+
return hasRightElement(tr.root, keys[len(keys)-1]), nil
567567
}
568568

569569
// get returns the child of the given node. Return nil if the

0 commit comments

Comments
 (0)