Skip to content

Commit

Permalink
don't delete from the trie when we encounter empty state object if ve…
Browse files Browse the repository at this point in the history
…rkle is enabled (ethereum#74)
  • Loading branch information
jwasinger authored Feb 9, 2022
1 parent c270886 commit cd491b1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
}

Expand Down

0 comments on commit cd491b1

Please sign in to comment.