Skip to content

Commit

Permalink
fix: correctly prune transactions during on-disk reorgs (#12630)
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr authored Nov 18, 2024
1 parent 8339c71 commit 2dc75fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/storage/provider/src/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ where
let tx_range = self
.database()
.transaction_range_by_block_range(block_number + 1..=highest_static_file_block)?;
let total_txs = tx_range.end().saturating_sub(*tx_range.start());
// We are using end + 1 - start here because the returned range is inclusive.
let total_txs = (tx_range.end() + 1).saturating_sub(*tx_range.start());

// IMPORTANT: we use `block_number+1` to make sure we remove only what is ABOVE the block
debug!(target: "provider::storage_writer", ?block_number, "Removing blocks from database above block_number");
Expand Down

0 comments on commit 2dc75fb

Please sign in to comment.