diff --git a/core/state/snapshot/snapshot.go b/core/state/snapshot/snapshot.go index 4c8195243..ca1d45844 100644 --- a/core/state/snapshot/snapshot.go +++ b/core/state/snapshot/snapshot.go @@ -560,14 +560,17 @@ func diffToDisk(bottom *diffLayer) *diskLayer { // Destroy all the destructed accounts from the database for hash := range bottom.destructSet { - oldAccount, err := base.account(hash, true) // Skip any account not covered yet by the snapshot - if errors.Is(err, ErrNotCoveredYet) { + if base.genMarker != nil && bytes.Compare(hash[:], base.genMarker) > 0 { continue } + + // Delete the account snapshot rawdb.DeleteAccountSnapshot(batch, hash) base.cache.Set(hash[:], nil) + // Try to check if there's any associated storage to delete from the snapshot + oldAccount, err := base.account(hash, true) if err != nil { log.Warn("Failed to get destructed account from snapshot", "err", err) // Fall through to deleting storage in case this account has any