Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions core/rawdb/ancient_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@

// 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
tail uint64 // The number of first stored item 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 {
return info.head - info.tail + 1
name string // The identifier of 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
}

// size returns the storage size of the entire freezer.
Expand All @@ -65,14 +61,24 @@
if err != nil {
return freezerInfo{}, err
}
info.head = ancients - 1
info.ancients = ancients

Check failure on line 64 in core/rawdb/ancient_utils.go

View workflow job for this annotation

GitHub Actions / Lint

info.ancients undefined (type freezerInfo has no field or method ancients) (typecheck)
if ancients > 0 {
info.head = ancients - 1
} else {
info.head = 0
}

// Retrieve the number of first stored item
tail, err := reader.Tail()
if err != nil {
return freezerInfo{}, err
}
info.tail = tail
if ancients == 0 {
info.count = 0
} else {
info.count = info.head - info.tail + 1
}
return info, nil
}

Expand Down
2 changes: 1 addition & 1 deletion core/rawdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
Loading