mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix: respect --debug.terminate --debug.max-block (#11710)
This commit is contained in:
@ -806,6 +806,15 @@ where
|
|||||||
Ok(initial_target)
|
Ok(initial_target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the node should terminate after the initial backfill run.
|
||||||
|
///
|
||||||
|
/// This is the case if any of these configs are set:
|
||||||
|
/// `--debug.max-block`
|
||||||
|
/// `--debug.terminate`
|
||||||
|
pub const fn terminate_after_initial_backfill(&self) -> bool {
|
||||||
|
self.node_config().debug.terminate || self.node_config().debug.max_block.is_some()
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if the pipeline is consistent (all stages have the checkpoint block numbers no less
|
/// Check if the pipeline is consistent (all stages have the checkpoint block numbers no less
|
||||||
/// than the checkpoint of the first stage).
|
/// than the checkpoint of the first stage).
|
||||||
///
|
///
|
||||||
|
|||||||
@ -334,6 +334,8 @@ where
|
|||||||
.fuse();
|
.fuse();
|
||||||
let chainspec = ctx.chain_spec();
|
let chainspec = ctx.chain_spec();
|
||||||
let (exit, rx) = oneshot::channel();
|
let (exit, rx) = oneshot::channel();
|
||||||
|
let terminate_after_backfill = ctx.terminate_after_initial_backfill();
|
||||||
|
|
||||||
info!(target: "reth::cli", "Starting consensus engine");
|
info!(target: "reth::cli", "Starting consensus engine");
|
||||||
ctx.task_executor().spawn_critical("consensus engine", async move {
|
ctx.task_executor().spawn_critical("consensus engine", async move {
|
||||||
if let Some(initial_target) = initial_target {
|
if let Some(initial_target) = initial_target {
|
||||||
@ -357,6 +359,11 @@ where
|
|||||||
debug!(target: "reth::cli", "Event: {event}");
|
debug!(target: "reth::cli", "Event: {event}");
|
||||||
match event {
|
match event {
|
||||||
ChainEvent::BackfillSyncFinished => {
|
ChainEvent::BackfillSyncFinished => {
|
||||||
|
if terminate_after_backfill {
|
||||||
|
debug!(target: "reth::cli", "Terminating after initial backfill");
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
network_handle.update_sync_state(SyncState::Idle);
|
network_handle.update_sync_state(SyncState::Idle);
|
||||||
}
|
}
|
||||||
ChainEvent::BackfillSyncStarted => {
|
ChainEvent::BackfillSyncStarted => {
|
||||||
|
|||||||
Reference in New Issue
Block a user