From 4436e15810bb952cfcbbe24584d1ceafaf79a4aa Mon Sep 17 00:00:00 2001 From: Chris Li <271678682li@gmail.com> Date: Tue, 16 Jul 2024 18:47:45 +0800 Subject: [PATCH] fix: change some code styles --- core/rawdb/prunedfreezer.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/rawdb/prunedfreezer.go b/core/rawdb/prunedfreezer.go index 46e85ec44a..c42b3c090c 100644 --- a/core/rawdb/prunedfreezer.go +++ b/core/rawdb/prunedfreezer.go @@ -99,10 +99,9 @@ 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 := minItems + if offset == 0 { + // no item in ancientDB, init `offset` to the `f.frozen` offset = atomic.LoadUint64(&f.frozen) } log.Info("Read ancientdb item counts", "items", minItems, "offset", offset)