reth icon indicating copy to clipboard operation
reth copied to clipboard

fix(prune): Use checked_sub and preserve Option in ReceiptsByLogs checkpoint

Open radik878 opened this issue 1 month ago • 0 comments
trafficstars

  • Replace saturating_sub with checked_sub when computing last_pruned_block to preserve None on underflow (meaning “block 0 not finished yet”) per PruneCheckpoint contract.
  • Save checkpoint with block_number: last_pruned_block.map(|b| prune_mode_block.min(b)) instead of forcing Some(...), maintaining the correct semantics and aligning with other segments (e.g., receipts, transaction_lookup).
  • This prevents incorrectly marking pruning as finished up to block 0 and ensures consistent checkpoint behavior across segments.

radik878 avatar Sep 30 '25 14:09 radik878