Skip to content

Commit

Permalink
validator: Use a const for wait for supermajority threshold (#16391)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7a2a390)

Co-authored-by: Trent Nelson <[email protected]>
  • Loading branch information
mergify[bot] and t-nelson authored Apr 6, 2021
1 parent a23fb49 commit 624f979
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 624f979

Please sign in to comment.