From 17ffdf1a9d79a010873b7a2e28f1a5f17a4f3e11 Mon Sep 17 00:00:00 2001 From: Nathan <122502194+NathanBSC@users.noreply.github.com> Date: Tue, 10 Oct 2023 18:15:24 +0800 Subject: [PATCH] core/state: skip deleting storages for EmptyTrie (#1911) --- core/state/statedb.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/state/statedb.go b/core/state/statedb.go index dc78c14cdf..fa2fb4b358 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1350,6 +1350,10 @@ func (s *StateDB) deleteStorage(addr common.Address, addrHash common.Hash, root if err != nil { return false, nil, nil, fmt.Errorf("failed to open storage trie, err: %w", err) } + // skip deleting storages for EmptyTrie + if _, ok := tr.(*trie.EmptyTrie); ok { + return false, nil, nil, nil + } it, err := tr.NodeIterator(nil) if err != nil { return false, nil, nil, fmt.Errorf("failed to open storage iterator, err: %w", err)