Skip to content

Commit

Permalink
fix: change some code styles
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi committed Jul 16, 2024
1 parent 42ac744 commit c018f66
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/rawdb/prunedfreezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func newPrunedFreezer(datadir string, db ethdb.KeyValueStore, offset uint64) (*p

// repair init frozen , compatible disk-ancientdb and pruner-block-tool.
func (f *prunedfreezer) repair(datadir string) error {
offset := atomic.LoadUint64(&f.frozen)
// compatible freezer
minItems := uint64(math.MaxUint64)
for name, disableSnappy := range chainFreezerNoSnappy {
Expand Down Expand Up @@ -100,14 +99,17 @@ func (f *prunedfreezer) repair(datadir string) error {
// If minItems is non-zero, it indicates that the chain freezer was previously enabled, and we should use minItems as the current frozen value.
// If minItems is zero, it indicates that the pruneAncient was previously enabled, and we should continue using frozen
// (retrieved from CurrentAncientFreezer) as the current frozen value.
var offset uint64
if minItems != 0 {
offset = minItems
} else {
offset = atomic.LoadUint64(&f.frozen)
}
log.Info("Read ancientdb item counts", "items", minItems, "offset", offset)

// FrozenOfAncientFreezer is the progress of the last prune-freezer freeze.
frozen := ReadFrozenOfAncientFreezer(f.db)
offset = max(offset, frozen)
frozenInDB := ReadFrozenOfAncientFreezer(f.db)
offset = max(offset, frozenInDB)

atomic.StoreUint64(&f.frozen, offset)
if err := f.Sync(); err != nil {
Expand Down

0 comments on commit c018f66

Please sign in to comment.