Skip to content

Commit

Permalink
core/rawdb: indextx adjust offset of pruned block
Browse files Browse the repository at this point in the history
Signed-off-by: Delweng <delweng@gmail.com>
  • Loading branch information
jsvisa committed Feb 20, 2023
1 parent 7e51a8b commit cf385ab
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/rawdb/chain_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ 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) {
// adjust range boundary for pruned block
if offset := db.AncientOffSet(); offset > from {
from = offset
}
// short circuit for invalid range
if from >= to {
return
Expand Down Expand Up @@ -271,6 +275,10 @@ 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) {
// adjust range boundary for pruned block
if offset := db.AncientOffSet(); offset > from {
from = offset
}
// short circuit for invalid range
if from >= to {
return
Expand Down

0 comments on commit cf385ab

Please sign in to comment.