From c558c1d10f005f47d291f0768f02f99cd1c099a5 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Mon, 9 Feb 2026 17:36:20 +0000 Subject: [PATCH] fix(stages): skip sender unwind when fully pruned (#21988) --- .../stages/stages/src/stages/sender_recovery.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/stages/stages/src/stages/sender_recovery.rs b/crates/stages/stages/src/stages/sender_recovery.rs index dfe57330e2..49fd38f417 100644 --- a/crates/stages/stages/src/stages/sender_recovery.rs +++ b/crates/stages/stages/src/stages/sender_recovery.rs @@ -202,13 +202,16 @@ where ) -> Result { let (_, unwind_to, _) = input.unwind_block_range_with_threshold(self.commit_threshold); - // Lookup the next tx id after unwind_to block (first tx to remove) - let unwind_tx_from = provider - .block_body_indices(unwind_to)? - .ok_or(ProviderError::BlockBodyIndicesNotFound(unwind_to))? - .next_tx_num(); + if self.prune_mode.is_none_or(|mode| !mode.is_full()) { + // Lookup the next tx id after unwind_to block (first tx to remove) + let unwind_tx_from = provider + .block_body_indices(unwind_to)? + .ok_or(ProviderError::BlockBodyIndicesNotFound(unwind_to))? + .next_tx_num(); - EitherWriter::new_senders(provider, unwind_to)?.prune_senders(unwind_tx_from, unwind_to)?; + EitherWriter::new_senders(provider, unwind_to)? + .prune_senders(unwind_tx_from, unwind_to)?; + } Ok(UnwindOutput { checkpoint: StageCheckpoint::new(unwind_to)