From 2df0754cb3975374518e04de77df71fbcc2f5f1f Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Fri, 28 Jun 2024 17:35:53 +0800 Subject: [PATCH] fix: disable parlia task if running with debug.tip (#48) * fix: disable parlia task if running with debug.tip * chore: fix lint * chore: fix lint --- crates/bsc/consensus/src/lib.rs | 24 +++++++++++++----------- crates/node/builder/src/launch/mod.rs | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/crates/bsc/consensus/src/lib.rs b/crates/bsc/consensus/src/lib.rs index f8f7bf61557f..75e81f0fdabc 100644 --- a/crates/bsc/consensus/src/lib.rs +++ b/crates/bsc/consensus/src/lib.rs @@ -637,7 +637,7 @@ where /// Consumes the type and returns all components #[track_caller] - pub fn build(self) -> ParliaClient { + pub fn build(self, start_engine_task: bool) -> ParliaClient { let Self { chain_spec, cfg, @@ -648,16 +648,18 @@ where client, } = self; let parlia_client = ParliaClient::new(storage.clone(), fetch_client); - ParliaEngineTask::start( - chain_spec.clone(), - Parlia::new(chain_spec, cfg.clone()), - client, - to_engine, - network_block_event_rx, - storage, - parlia_client.clone(), - cfg.period, - ); + if start_engine_task { + ParliaEngineTask::start( + chain_spec.clone(), + Parlia::new(chain_spec, cfg.clone()), + client, + to_engine, + network_block_event_rx, + storage, + parlia_client.clone(), + cfg.period, + ); + } parlia_client } } diff --git a/crates/node/builder/src/launch/mod.rs b/crates/node/builder/src/launch/mod.rs index 91707503084e..d60d1a42e2ad 100644 --- a/crates/node/builder/src/launch/mod.rs +++ b/crates/node/builder/src/launch/mod.rs @@ -281,7 +281,7 @@ where engine_rx, network_client.clone(), ) - .build(); + .build(ctx.node_config().debug.tip.is_none()); (pipeline, Either::Right(client)) } #[cfg(not(feature = "bsc"))]