core/rawdb: update

This commit is contained in:
Felix Lange 2025-03-14 18:02:15 +01:00
parent da9ebaea44
commit 8afbdfa436

View file

@ -315,8 +315,8 @@ func (f *Freezer) TruncateTailBlocks(tailBlock uint64) (uint64, error) {
if old >= tailBlock { if old >= tailBlock {
return old, nil return old, nil
} }
for kind, table := range f.tables { for _, table := range f.tables {
if kind == ChainFreezerBodiesTable || kind == ChainFreezerReceiptTable { if table.config.prunable {
if err := table.truncateTail(tailBlock); err != nil { if err := table.truncateTail(tailBlock); err != nil {
return 0, err return 0, err
} }
@ -372,12 +372,11 @@ func (f *Freezer) validate() error {
head uint64 head uint64
prunedTail *uint64 prunedTail *uint64
) )
// hack to get the head // get any head value
for _, table := range f.tables { for _, table := range f.tables {
head = table.items.Load() head = table.items.Load()
break break
} }
for kind, table := range f.tables { for kind, table := range f.tables {
// all tables have to have the same head // all tables have to have the same head
if head != table.items.Load() { if head != table.items.Load() {