eth/protocols/snap: save nodes on right boundary in hash mode

This commit is contained in:
Gary Rong 2024-05-16 13:44:40 +08:00
parent 7ed52c949e
commit 90b83aaec1

View file

@ -280,8 +280,9 @@ func (t *hashTrie) update(key, value []byte) error {
// commit implements genTrie interface, committing the nodes on right boundary.
func (t *hashTrie) commit(complete bool) common.Hash {
hash := t.tr.Hash() // flush the nodes on right boundary
if !complete {
return common.Hash{} // the hash is meaningless for incomplete commit
}
return t.tr.Hash() // return hash only if it's claimed as complete
return hash // return hash only if it's claimed as complete
}