Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): reduce one block behind waiting period #3798

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down