From 46d670eca56f18d619bec201e1769de60973c8d4 Mon Sep 17 00:00:00 2001 From: YK Date: Tue, 13 Jan 2026 03:22:49 +0800 Subject: [PATCH] fix(stages): use static files for unwind in SenderRecovery stage (#20972) Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com> --- crates/stages/stages/src/stages/sender_recovery.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/stages/stages/src/stages/sender_recovery.rs b/crates/stages/stages/src/stages/sender_recovery.rs index 899b8cd6c1..67df242168 100644 --- a/crates/stages/stages/src/stages/sender_recovery.rs +++ b/crates/stages/stages/src/stages/sender_recovery.rs @@ -7,7 +7,7 @@ use reth_db_api::{ table::Value, tables, transaction::{DbTx, DbTxMut}, - DbTxUnwindExt, RawValue, + RawValue, }; use reth_primitives_traits::{GotExpected, NodePrimitives, SignedTransaction}; use reth_provider::{ @@ -158,12 +158,13 @@ where ) -> Result { let (_, unwind_to, _) = input.unwind_block_range_with_threshold(self.commit_threshold); - // Lookup latest tx id that we should unwind to - let latest_tx_id = provider + // 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))? - .last_tx_num(); - provider.tx_ref().unwind_table_by_num::(latest_tx_id)?; + .next_tx_num(); + + EitherWriter::new_senders(provider, unwind_to)?.prune_senders(unwind_tx_from, unwind_to)?; Ok(UnwindOutput { checkpoint: StageCheckpoint::new(unwind_to)