Skip to content

Commit

Permalink
core: truncatetail missing f.offset
Browse files Browse the repository at this point in the history
Signed-off-by: Delweng <delweng@gmail.com>
  • Loading branch information
jsvisa committed Mar 17, 2023
1 parent b4ad6c0 commit cf25261
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/rawdb/freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (f *freezer) TruncateHead(items uint64) error {
return nil
}
for _, table := range f.tables {
if err := table.truncateHead(items); err != nil {
if err := table.truncateHead(items - f.offset); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/state/pruner/pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func (p *BlockPruner) backupOldDb(name string, cache, handles int, namespace str
// For every round, newoffset actually equals to the startBlockNumber in ancient backup db.
frdbBack, err := rawdb.NewFreezerDb(chainDb, p.newAncientPath, namespace, readonly, startBlockNumber)
if err != nil {
log.Error("Failed to create ancient freezer backup", "err=", err)
log.Error("Failed to create ancient freezer backup", "err", err)
return err
}
defer frdbBack.Close()
Expand Down Expand Up @@ -438,7 +438,7 @@ func (p *BlockPruner) backupOldDb(name string, cache, handles int, namespace str
}
// Write into new ancient_back db.
if _, err := rawdb.WriteAncientBlocks(frdbBack, []*types.Block{block}, []types.Receipts{receipts}, []types.Receipts{borReceipts}, td); err != nil {
log.Error("failed to write new ancient", "error", err)
log.Error("failed to write new ancient", "err", err)
return err
}
// Print the log every 5s for better trace.
Expand Down

0 comments on commit cf25261

Please sign in to comment.