From 15e5fd81c7fd458928d61886755a200371d6bac1 Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Mon, 17 Nov 2025 12:20:38 +0000 Subject: [PATCH] accept changes --- core/rawdb/ancient_utils.go | 14 ++++++-------- core/rawdb/database.go | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/core/rawdb/ancient_utils.go b/core/rawdb/ancient_utils.go index b576de37a5..c38124da8b 100644 --- a/core/rawdb/ancient_utils.go +++ b/core/rawdb/ancient_utils.go @@ -35,17 +35,10 @@ type freezerInfo struct { ancients uint64 // The total number of stored items in the freezer head uint64 // The number of last stored item in the freezer, valid only if ancients > 0 tail uint64 // The number of first stored item in the freezer + count uint64 // The number of stored items in the freezer sizes []tableSize // The storage size per table } -// count returns the number of stored items in the freezer. -func (info *freezerInfo) count() uint64 { - if info.ancients <= info.tail { - return 0 - } - return info.ancients - info.tail -} - // size returns the storage size of the entire freezer. func (info *freezerInfo) size() common.StorageSize { var total common.StorageSize @@ -82,6 +75,11 @@ func inspect(name string, order map[string]freezerTableConfig, reader ethdb.Anci return freezerInfo{}, err } info.tail = tail + if ancients == 0 { + info.count = 0 + } else { + info.count = info.head - info.tail + 1 + } return info, nil } diff --git a/core/rawdb/database.go b/core/rawdb/database.go index d5c0f0aab2..448922d9bd 100644 --- a/core/rawdb/database.go +++ b/core/rawdb/database.go @@ -644,7 +644,7 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error { fmt.Sprintf("Ancient store (%s)", strings.Title(ancient.name)), strings.Title(table.name), table.size.String(), - fmt.Sprintf("%d", ancient.count()), + fmt.Sprintf("%d", ancient.count), }) } total.Add(uint64(ancient.size()))