Skip to content

Commit

Permalink
Revert "core/state/snapshot: fix BAD BLOCK error when snapshot is gen…
Browse files Browse the repository at this point in the history
…erating (ethereum#23635)"

This reverts commit 312e02b.
  • Loading branch information
greatestvillain authored Jan 24, 2022
1 parent f9ce40b commit 1cf3bad
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions core/state/snapshot/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,6 @@ func (dl *diskLayer) generate(stats *generatorStats) {
default:
}
if batch.ValueSize() > ethdb.IdealBatchSize || abort != nil {
if bytes.Compare(currentLocation, dl.genMarker) < 0 {
log.Error("Snapshot generator went backwards",
"currentLocation", fmt.Sprintf("%x", currentLocation),
"genMarker", fmt.Sprintf("%x", dl.genMarker))
}

// Flush out the batch anyway no matter it's empty or not.
// It's possible that all the states are recovered and the
// generation indeed makes progress.
Expand Down Expand Up @@ -640,14 +634,8 @@ func (dl *diskLayer) generate(stats *generatorStats) {
stats.storage += common.StorageSize(1 + common.HashLength + dataLen)
stats.accounts++
}
marker := accountHash[:]
// If the snap generation goes here after interrupted, genMarker may go backward
// when last genMarker is consisted of accountHash and storageHash
if accMarker != nil && bytes.Equal(marker, accMarker) && len(dl.genMarker) > common.HashLength {
marker = dl.genMarker[:]
}
// If we've exceeded our batch allowance or termination was requested, flush to disk
if err := checkAndFlush(marker); err != nil {
if err := checkAndFlush(accountHash[:]); err != nil {
return err
}
// If the iterated account is the contract, create a further loop to
Expand Down

0 comments on commit 1cf3bad

Please sign in to comment.