fix: small networking fixes (#16742)

This commit is contained in:
Arsenii Kulikov
2025-06-10 14:32:18 +02:00
committed by GitHub
parent 895b0e9f82
commit 1bef0092ee
4 changed files with 18 additions and 7 deletions

View File

@@ -138,11 +138,15 @@ where
.await?;
// create pipeline
let network_client = ctx.components().network().fetch_client().await?;
let network_handle = ctx.components().network().clone();
let network_client = network_handle.fetch_client().await?;
let (consensus_engine_tx, consensus_engine_rx) = unbounded_channel();
let node_config = ctx.node_config();
// We always assume that node is syncing after a restart
network_handle.update_sync_state(SyncState::Syncing);
let max_block = ctx.max_block(network_client.clone()).await?;
let static_file_producer = ctx.static_file_producer();
@@ -289,7 +293,6 @@ where
// Run consensus engine to completion
let initial_target = ctx.initial_backfill_target()?;
let network_handle = ctx.components().network().clone();
let mut built_payloads = ctx
.components()
.payload_builder_handle()
@@ -329,8 +332,6 @@ where
debug!(target: "reth::cli", "Terminating after initial backfill");
break
}
network_handle.update_sync_state(SyncState::Idle);
}
ChainEvent::BackfillSyncStarted => {
network_handle.update_sync_state(SyncState::Syncing);
@@ -342,6 +343,8 @@ where
}
ChainEvent::Handler(ev) => {
if let Some(head) = ev.canonical_header() {
// Once we're progressing via live sync, we can consider the node is not syncing anymore
network_handle.update_sync_state(SyncState::Idle);
let head_block = Head {
number: head.number(),
hash: head.hash(),