Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/node/builder/src/launch/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,16 @@ impl EngineNodeLauncher {
let provider = ctx.blockchain_db().clone();
let (exit, rx) = oneshot::channel();
let terminate_after_backfill = ctx.terminate_after_initial_backfill();
let startup_sync_state_idle = ctx.node_config().debug.startup_sync_state_idle;

info!(target: "reth::cli", "Starting consensus engine");
ctx.task_executor().spawn_critical("consensus engine", Box::pin(async move {
if let Some(initial_target) = initial_target {
debug!(target: "reth::cli", %initial_target, "start backfill sync");
// network_handle's sync state is already initialized at Syncing
engine_service.orchestrator_mut().start_backfill_sync(initial_target);
} else if startup_sync_state_idle {
network_handle.update_sync_state(SyncState::Idle);
}

let mut res = Ok(());
Expand All @@ -289,6 +293,9 @@ impl EngineNodeLauncher {
debug!(target: "reth::cli", "Terminating after initial backfill");
break
}
if startup_sync_state_idle {
network_handle.update_sync_state(SyncState::Idle);
}
}
ChainEvent::BackfillSyncStarted => {
network_handle.update_sync_state(SyncState::Syncing);
Expand Down
8 changes: 8 additions & 0 deletions crates/node/core/src/args/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ pub struct DebugArgs {
/// Example: `nodename:secret@host:port`
#[arg(long = "ethstats", help_heading = "Debug")]
pub ethstats: Option<String>,

/// Set the node to idle state when the backfill is not running.
///
/// This makes the `eth_syncing` RPC return "Idle" when the node has just started or finished
/// the backfill, but did not yet receive any new blocks.
#[arg(long = "debug.startup-sync-state-idle", help_heading = "Debug")]
pub startup_sync_state_idle: bool,
}

impl Default for DebugArgs {
Expand All @@ -119,6 +126,7 @@ impl Default for DebugArgs {
invalid_block_hook: Some(InvalidBlockSelection::default()),
healthy_node_rpc_url: None,
ethstats: None,
startup_sync_state_idle: false,
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions docs/vocs/docs/pages/cli/reth/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,11 @@ Debug:
--ethstats <ETHSTATS>
The URL of the ethstats server to connect to. Example: `nodename:secret@host:port`

--debug.startup-sync-state-idle
Set the node to idle state when the backfill is not running.

This makes the `eth_syncing` RPC return "Idle" when the node has just started or finished the backfill, but did not yet receive any new blocks.

Database:
--db.log-level <LOG_LEVEL>
Database logging level. Levels higher than "notice" require a debug build
Expand Down