mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
unwind tracing (#750)
This commit is contained in:
@@ -183,6 +183,7 @@ impl<DB: Database, D: BodyDownloader, C: Consensus> Stage<DB> for BodyStage<D, C
|
||||
tx: &mut Transaction<'_, DB>,
|
||||
input: UnwindInput,
|
||||
) -> Result<UnwindOutput, StageError> {
|
||||
info!(target: "sync::stages::bodies", to_block = input.unwind_to, "Unwinding");
|
||||
// Cursors to unwind bodies, ommers, transactions and tx hash to number
|
||||
let mut body_cursor = tx.cursor_mut::<tables::BlockBodies>()?;
|
||||
let mut ommers_cursor = tx.cursor_mut::<tables::BlockOmmers>()?;
|
||||
|
||||
@@ -291,6 +291,8 @@ impl<DB: Database> Stage<DB> for ExecutionStage {
|
||||
tx: &mut Transaction<'_, DB>,
|
||||
input: UnwindInput,
|
||||
) -> Result<UnwindOutput, StageError> {
|
||||
info!(target: "sync::stages::execution", to_block = input.unwind_to, "Unwinding");
|
||||
|
||||
// Acquire changeset cursors
|
||||
let mut account_changeset = tx.cursor_dup_mut::<tables::AccountChangeSet>()?;
|
||||
let mut storage_changeset = tx.cursor_dup_mut::<tables::StorageChangeSet>()?;
|
||||
|
||||
@@ -144,6 +144,7 @@ impl<DB: Database, D: HeaderDownloader, C: Consensus, H: HeadersClient, S: Statu
|
||||
input: UnwindInput,
|
||||
) -> Result<UnwindOutput, StageError> {
|
||||
// TODO: handle bad block
|
||||
info!(target: "sync::stages::headers", to_block = input.unwind_to, "Unwinding");
|
||||
tx.unwind_table_by_walker::<tables::CanonicalHeaders, tables::HeaderNumbers>(
|
||||
input.unwind_to + 1,
|
||||
)?;
|
||||
|
||||
@@ -116,6 +116,7 @@ impl<DB: Database> Stage<DB> for SenderRecoveryStage {
|
||||
tx: &mut Transaction<'_, DB>,
|
||||
input: UnwindInput,
|
||||
) -> Result<UnwindOutput, StageError> {
|
||||
info!(target: "sync::stages::sender_recovery", to_block = input.unwind_to, "Unwinding");
|
||||
// Lookup latest tx id that we should unwind to
|
||||
let latest_tx_id = tx.get_block_body_by_num(input.unwind_to)?.last_tx_index();
|
||||
tx.unwind_table_by_num::<tables::TxSenders>(latest_tx_id)?;
|
||||
|
||||
@@ -77,6 +77,7 @@ impl<DB: Database> Stage<DB> for TotalDifficultyStage {
|
||||
tx: &mut Transaction<'_, DB>,
|
||||
input: UnwindInput,
|
||||
) -> Result<UnwindOutput, StageError> {
|
||||
info!(target: "sync::stages::total_difficulty", to_block = input.unwind_to, "Unwinding");
|
||||
tx.unwind_table_by_num_hash::<tables::HeaderTD>(input.unwind_to)?;
|
||||
Ok(UnwindOutput { stage_progress: input.unwind_to })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user