chore: apply some style suggestions (#7307)

This commit is contained in:
Matthias Seitz
2024-03-24 23:52:33 +01:00
committed by GitHub
parent 7e6d61a66a
commit a31202670b
39 changed files with 184 additions and 182 deletions

View File

@ -91,13 +91,14 @@ impl<DB: Database> Pruner<DB> {
// `self.prune_max_blocks_per_run`.
//
// Also see docs for `self.previous_tip_block_number`.
let blocks_since_last_run =
(self.previous_tip_block_number.map_or(1, |previous_tip_block_number| {
let blocks_since_last_run = self
.previous_tip_block_number
.map_or(1, |previous_tip_block_number| {
// Saturating subtraction is needed for the case when the chain was reverted,
// meaning current block number might be less than the previous tip
// block number.
tip_block_number.saturating_sub(previous_tip_block_number) as usize
}))
})
.min(self.prune_max_blocks_per_run);
let delete_limit = self.delete_limit * blocks_since_last_run;

View File

@ -42,7 +42,7 @@ impl<DB: Database> Segment<DB> for TransactionLookup {
}
}
.into_inner();
let tx_range = start..=(end.min(start + input.delete_limit as u64 - 1));
let tx_range = start..=end.min(start + input.delete_limit as u64 - 1);
let tx_range_end = *tx_range.end();
// Retrieve transactions in the range and calculate their hashes in parallel