From cd491b107b211edfa2ec8f6c1b4cf19ad43df30e Mon Sep 17 00:00:00 2001 From: jwasinger Date: Tue, 8 Feb 2022 22:12:26 -1000 Subject: [PATCH] don't delete from the trie when we encounter empty state object if verkle is enabled (#74) --- core/state/statedb.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 3a63e7faceea..d31b50172788 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -550,17 +550,13 @@ func (s *StateDB) deleteStateObject(obj *stateObject) { } // Delete the account from the trie + // Post-verkle, the only case where this can occur is a static call + // to a non-existent account which creates an empty stateObject if !s.trie.IsVerkle() { addr := obj.Address() if err := s.trie.TryDelete(addr[:]); err != nil { s.setError(fmt.Errorf("deleteStateObject (%x) error: %v", addr[:], err)) } - } else { - for i := byte(0); i <= 255; i++ { - if err := s.trie.TryDelete(trieUtils.GetTreeKeyAccountLeaf(obj.Address().Bytes(), i)); err != nil { - s.setError(fmt.Errorf("deleteStateObject (%x) error: %v", obj.Address(), err)) - } - } } }