From 624f9790bd0c04e615c183230cc4cdc26147baa1 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 6 Apr 2021 05:02:25 +0000 Subject: [PATCH] validator: Use a const for wait for supermajority threshold (#16391) (cherry picked from commit 7a2a39093d40c3ca4768a1cd52325ba78b3771c9) Co-authored-by: Trent Nelson --- core/src/validator.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/validator.rs b/core/src/validator.rs index 350b89b3aa..f5c7c28b39 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -77,6 +77,7 @@ use std::{ }; const MAX_COMPLETED_DATA_SETS_IN_CHANNEL: usize = 100_000; +const WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT: u64 = 90; #[derive(Clone, Debug)] pub struct ValidatorConfig { @@ -1262,14 +1263,15 @@ fn wait_for_supermajority( for i in 1.. { if i % 10 == 1 { info!( - "Waiting for 80% of activated stake at slot {} to be in gossip...", + "Waiting for {}% of activated stake at slot {} to be in gossip...", + WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT, bank.slot() ); } let gossip_stake_percent = get_stake_percent_in_gossip(&bank, &cluster_info, i % 10 == 0); - if gossip_stake_percent >= 90 { + if gossip_stake_percent >= WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT { break; } // The normal RPC health checks don't apply as the node is waiting, so feign health to