Skip to content

Commit 7249fff

Browse files
committed
only start the pruner once the tip block has crossed the min block interval
1 parent ea4a4c7 commit 7249fff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/prune/src/pruner.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ impl<DB: Database> Pruner<DB> {
244244
/// Returns `true` if the pruning is needed at the provided tip block number.
245245
/// This determined by the check against minimum pruning interval and last pruned block number.
246246
pub fn is_pruning_needed(&self, tip_block_number: BlockNumber) -> bool {
247-
if self.previous_tip_block_number.map_or(true, |previous_tip_block_number| {
247+
if tip_block_number < self.min_block_interval as u64 {
248+
false
249+
} else if self.previous_tip_block_number.map_or(true, |previous_tip_block_number| {
248250
// Saturating subtraction is needed for the case when the chain was reverted, meaning
249251
// current block number might be less than the previous tip block number.
250252
// If that's the case, no pruning is needed as outdated data is also reverted.

0 commit comments

Comments
 (0)