feat: support initial target pipeline sync (#9683)

This commit is contained in:
Matthias Seitz
2024-07-22 10:15:05 +02:00
committed by GitHub
parent 9bca97e2a4
commit 9b3a011cf2
2 changed files with 11 additions and 2 deletions

View File

@@ -92,6 +92,11 @@ where
Self { orchestrator: ChainOrchestrator::new(handler, backfill_sync) }
}
/// Returns a mutable reference to the orchestrator.
pub fn orchestrator_mut(&mut self) -> &mut EthServiceType<DB, Client> {
&mut self.orchestrator
}
}
impl<DB, Client> Stream for EthService<DB, Client>

View File

@@ -146,8 +146,7 @@ where
let pipeline_events = pipeline.events();
// TODO: support --debug.tip
let _initial_target = ctx.node_config().debug.tip;
let initial_target = ctx.node_config().debug.tip;
let mut pruner_builder = ctx.pruner_builder();
if let Some(exex_manager_handle) = &exex_manager_handle {
@@ -237,6 +236,11 @@ where
let (tx, rx) = oneshot::channel();
info!(target: "reth::cli", "Starting consensus engine");
ctx.task_executor().spawn_critical_blocking("consensus engine", async move {
if let Some(initial_target) = initial_target {
debug!(target: "reth::cli", %initial_target, "start backfill sync");
eth_service.orchestrator_mut().start_backfill_sync(initial_target);
}
// advance the chain and handle events
while let Some(event) = eth_service.next().await {
debug!(target: "reth::cli", "Event: {event:?}");