From 3594925dafbcbab16a05403dd7dfa2e6ae5f074d Mon Sep 17 00:00:00 2001 From: Stanimal Date: Thu, 3 Feb 2022 22:49:12 +0400 Subject: [PATCH] fix(core): reduce one block behind waiting period --- .../src/base_node/state_machine_service/states/listening.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base_layer/core/src/base_node/state_machine_service/states/listening.rs b/base_layer/core/src/base_node/state_machine_service/states/listening.rs index e319f6d7c8..abb86c322b 100644 --- a/base_layer/core/src/base_node/state_machine_service/states/listening.rs +++ b/base_layer/core/src/base_node/state_machine_service/states/listening.rs @@ -55,6 +55,9 @@ use crate::{ const LOG_TARGET: &str = "c::bn::state_machine_service::states::listening"; +/// The length of time to wait for a propagated block when one block behind before proceeding to sync +const ONE_BLOCK_BEHIND_WAIT_PERIOD: Duration = Duration::from_secs(20); + /// This struct contains the info of the peer, and is used to serialised and deserialised. #[derive(Serialize, Deserialize)] pub struct PeerMetadata { @@ -195,7 +198,7 @@ impl Listening { if self.is_synced && best_metadata.height_of_longest_chain() == local.height_of_longest_chain() + 1 && time_since_better_block - .map(|ts: Instant| ts.elapsed() < Duration::from_secs(60)) + .map(|ts: Instant| ts.elapsed() < ONE_BLOCK_BEHIND_WAIT_PERIOD) .unwrap_or(true) { if time_since_better_block.is_none() {