Skip to content

Commit

Permalink
core/rawdb: handle ancient pruner offset in indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
manav2401 committed Jan 23, 2025
1 parent a153663 commit 7eb8806
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/rawdb/chain_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool
rlp rlp.RawValue
}

if offset := db.AncientOffSet(); offset > from {
from = offset
}

if to <= from {
return nil
}
Expand Down Expand Up @@ -206,6 +202,11 @@ func iterateTransactions(db ethdb.Database, from uint64, to uint64, reverse bool
// There is a passed channel, the whole procedure will be interrupted if any
// signal received.
func indexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan struct{}, hook func(uint64) bool, report bool) {
// Bor: If ancient data was pruned, adjust range accordingly.
if offset := db.AncientOffSet(); offset > from {
from = offset
}

// short circuit for invalid range
if from >= to {
return
Expand Down Expand Up @@ -309,6 +310,11 @@ func indexTransactionsForTesting(db ethdb.Database, from uint64, to uint64, inte
// There is a passed channel, the whole procedure will be interrupted if any
// signal received.
func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt chan struct{}, hook func(uint64) bool, report bool) {
// Bor: If ancient data was pruned, adjust range accordingly.
if offset := db.AncientOffSet(); offset > from {
from = offset
}

// short circuit for invalid range
if from >= to {
return
Expand Down

0 comments on commit 7eb8806

Please sign in to comment.