From 90b83aaec12ad741982ae7d578b3fb73fbfa9cb3 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Thu, 16 May 2024 13:44:40 +0800 Subject: [PATCH] eth/protocols/snap: save nodes on right boundary in hash mode --- eth/protocols/snap/gentrie.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth/protocols/snap/gentrie.go b/eth/protocols/snap/gentrie.go index 6255fb221d..7534c8ed55 100644 --- a/eth/protocols/snap/gentrie.go +++ b/eth/protocols/snap/gentrie.go @@ -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 }