Skip to content

Commit

Permalink
check tip block number
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Aug 22, 2023
1 parent a092d72 commit 45d801b
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions crates/prune/src/pruner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ impl<DB: Database> Pruner<DB> {

/// Run the pruner
pub fn run(&mut self, tip_block_number: BlockNumber) -> PrunerResult {
trace!(
target: "pruner",
%tip_block_number,
"Pruner started"
);
if tip_block_number == 0 {
trace!(target: "pruner", %tip_block_number, "Nothing to prune yet");
return Ok(true)
}

trace!(target: "pruner", %tip_block_number, "Pruner started");
let start = Instant::now();

let provider = self.provider_factory.provider_rw()?;
Expand All @@ -124,11 +125,7 @@ impl<DB: Database> Pruner<DB> {
.duration_seconds
.record(part_start.elapsed())
} else {
trace!(
target: "pruner",
prune_part = ?PrunePart::Receipts,
"No target block to prune"
);
trace!(target: "pruner", prune_part = ?PrunePart::Receipts, "No target block to prune");
}

if !self.modes.contract_logs_filter.is_empty() {
Expand Down Expand Up @@ -250,12 +247,7 @@ impl<DB: Database> Pruner<DB> {
let elapsed = start.elapsed();
self.metrics.duration_seconds.record(elapsed);

trace!(
target: "pruner",
%tip_block_number,
?elapsed,
"Pruner finished"
);
trace!(target: "pruner", %tip_block_number, ?elapsed, "Pruner finished");
Ok(done)
}

Expand Down

0 comments on commit 45d801b

Please sign in to comment.