diff --git a/.changelog/rich-lakes-bark.md b/.changelog/rich-lakes-bark.md new file mode 100644 index 0000000000..9ef7ccc7c8 --- /dev/null +++ b/.changelog/rich-lakes-bark.md @@ -0,0 +1,5 @@ +--- +reth-provider: patch +--- + +Fixed sender pruning during block reorg to skip when sender_recovery is fully pruned, preventing a fatal crash when no sender data exists in static files. diff --git a/crates/storage/provider/src/providers/database/provider.rs b/crates/storage/provider/src/providers/database/provider.rs index 5d1750b446..5659d3b250 100644 --- a/crates/storage/provider/src/providers/database/provider.rs +++ b/crates/storage/provider/src/providers/database/provider.rs @@ -3576,7 +3576,12 @@ impl BlockWriter })?; } - EitherWriter::new_senders(self, last_block_number)?.prune_senders(unwind_tx_from, block)?; + // Skip sender pruning when sender_recovery is fully pruned, since no sender data + // exists in static files or the database. + if self.prune_modes.sender_recovery.is_none_or(|m| !m.is_full()) { + EitherWriter::new_senders(self, last_block_number)? + .prune_senders(unwind_tx_from, block)?; + } self.remove_bodies_above(block)?;