Refactor freezerInfo head assignment logic

Removed unnecessary condition for setting head in freezerInfo.
This commit is contained in:
rjl493456442 2025-11-24 21:03:04 +08:00 committed by GitHub
parent 182d798c5f
commit 8d4dd2ae93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,7 +32,7 @@ type tableSize struct {
// freezerInfo contains the basic information of the freezer.
type freezerInfo struct {
name string // The identifier of freezer
head uint64 // The number of last stored item in the freezer, valid only if ancients > 0
head uint64 // The number of last stored item in the freezer
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
@ -61,7 +61,6 @@ func inspect(name string, order map[string]freezerTableConfig, reader ethdb.Anci
if err != nil {
return freezerInfo{}, err
}
info.ancients = ancients
if ancients > 0 {
info.head = ancients - 1
} else {
@ -74,6 +73,7 @@ func inspect(name string, order map[string]freezerTableConfig, reader ethdb.Anci
return freezerInfo{}, err
}
info.tail = tail
if ancients == 0 {
info.count = 0
} else {