core/rawdb: simplify condition

This commit is contained in:
Felix Lange 2025-03-19 09:09:08 +01:00
parent 36cb9a7d6d
commit 36e5879647

View file

@ -367,11 +367,8 @@ func unindexTransactionsForTesting(db ethdb.Database, from uint64, to uint64, in
// PruneTransactionIndex removes all tx index entries below a certain block number.
func PruneTransactionIndex(db ethdb.Database, pruneBlock uint64) {
tail := ReadTxIndexTail(db)
if tail == nil {
return // no index
}
if *tail > pruneBlock {
return // index ends above pruneBlock
if tail == nil || *tail > pruneBlock {
return // no index, or index ends above pruneBlock
}
// There are blocks below pruneBlock in the index. Iterate the entire index to remove