refactor: replaced update_status with update_block_range (#16840)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Ishika Choudhury
2025-06-17 14:21:10 +05:30
committed by GitHub
parent 46780aec28
commit 8477d652f6

View File

@@ -20,7 +20,7 @@ use reth_engine_tree::{
};
use reth_engine_util::EngineMessageStreamExt;
use reth_exex::ExExManagerHandle;
use reth_network::{NetworkSyncUpdater, SyncState};
use reth_network::{types::BlockRangeUpdate, NetworkSyncUpdater, SyncState};
use reth_network_api::BlockDownloaderProvider;
use reth_node_api::{
BeaconConsensusEngineHandle, BuiltPayload, FullNodeTypes, NodeTypes, NodeTypesWithDBAdapter,
@@ -301,6 +301,7 @@ where
.map_err(|e| eyre::eyre!("Failed to subscribe to payload builder events: {:?}", e))?
.into_built_payload_stream()
.fuse();
let chainspec = ctx.chain_spec();
let (exit, rx) = oneshot::channel();
let terminate_after_backfill = ctx.terminate_after_initial_backfill();
@@ -345,7 +346,7 @@ where
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 {
let head_block = Head {
number: head.number(),
hash: head.hash(),
difficulty: head.difficulty(),
@@ -353,6 +354,13 @@ where
total_difficulty: chainspec.final_paris_total_difficulty().filter(|_| chainspec.is_paris_active_at_block(head.number())).unwrap_or_default(),
};
network_handle.update_status(head_block);
let updated=BlockRangeUpdate{
earliest:0,
latest:head.number(),
latest_hash:head.hash()
};
network_handle.update_block_range(updated);
}
event_sender.notify(ev);
}