mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 09:51:36 +00:00
trie/bintrie: fix Parent() to return parent hash, not current node
This commit is contained in:
parent
c1fb257e2e
commit
cff5fca22f
1 changed files with 4 additions and 1 deletions
|
|
@ -173,7 +173,10 @@ func (it *binaryNodeIterator) Hash() common.Hash {
|
||||||
|
|
||||||
// Parent returns the hash of the parent of the current node.
|
// Parent returns the hash of the parent of the current node.
|
||||||
func (it *binaryNodeIterator) Parent() common.Hash {
|
func (it *binaryNodeIterator) Parent() common.Hash {
|
||||||
return it.store.ComputeHash(it.stack[len(it.stack)-1].Node)
|
if len(it.stack) < 2 {
|
||||||
|
return common.Hash{}
|
||||||
|
}
|
||||||
|
return it.store.ComputeHash(it.stack[len(it.stack)-2].Node)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path returns the hex-encoded path to the current node.
|
// Path returns the hex-encoded path to the current node.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue