mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core/rawdb: simplify condition
This commit is contained in:
parent
36cb9a7d6d
commit
36e5879647
1 changed files with 2 additions and 5 deletions
|
|
@ -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.
|
// PruneTransactionIndex removes all tx index entries below a certain block number.
|
||||||
func PruneTransactionIndex(db ethdb.Database, pruneBlock uint64) {
|
func PruneTransactionIndex(db ethdb.Database, pruneBlock uint64) {
|
||||||
tail := ReadTxIndexTail(db)
|
tail := ReadTxIndexTail(db)
|
||||||
if tail == nil {
|
if tail == nil || *tail > pruneBlock {
|
||||||
return // no index
|
return // no index, or index ends above pruneBlock
|
||||||
}
|
|
||||||
if *tail > pruneBlock {
|
|
||||||
return // index ends above pruneBlock
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are blocks below pruneBlock in the index. Iterate the entire index to remove
|
// There are blocks below pruneBlock in the index. Iterate the entire index to remove
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue