Skip to content

Commit

Permalink
fix: reset pruned sender numbers on stage drop (#11150)
Browse files Browse the repository at this point in the history
  • Loading branch information
hai-rise authored Oct 2, 2024
1 parent 16be8b9 commit c4ce997
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/cli/commands/src/stage/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ use itertools::Itertools;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_cli::chainspec::ChainSpecParser;
use reth_db::{static_file::iter_static_files, tables};
use reth_db_api::transaction::DbTxMut;
use reth_db_api::transaction::{DbTx, DbTxMut};
use reth_db_common::{
init::{insert_genesis_header, insert_genesis_history, insert_genesis_state},
DbTool,
};
use reth_node_builder::NodeTypesWithEngine;
use reth_node_core::args::StageEnum;
use reth_provider::{writer::UnifiedStorageWriter, StaticFileProviderFactory};
use reth_prune::PruneSegment;
use reth_stages::StageId;
use reth_static_file_types::StaticFileSegment;

Expand Down Expand Up @@ -89,6 +90,17 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> Command<C>
}
StageEnum::Senders => {
tx.clear::<tables::TransactionSenders>()?;
// Reset pruned numbers to not count them in the next rerun's stage progress
if let Some(mut prune_checkpoint) =
tx.get::<tables::PruneCheckpoints>(PruneSegment::SenderRecovery)?
{
prune_checkpoint.block_number = None;
prune_checkpoint.tx_number = None;
tx.put::<tables::PruneCheckpoints>(
PruneSegment::SenderRecovery,
prune_checkpoint,
)?;
}
tx.put::<tables::StageCheckpoints>(
StageId::SenderRecovery.to_string(),
Default::default(),
Expand Down

0 comments on commit c4ce997

Please sign in to comment.