Add check for propagation of leader block before generating further blocks (#8758)
Co-authored-by: Carl <carl@solana.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::replay_stage::ProgressMap;
|
||||
use crate::progress_map::ProgressMap;
|
||||
use chrono::prelude::*;
|
||||
use solana_ledger::bank_forks::BankForks;
|
||||
use solana_runtime::bank::Bank;
|
||||
@@ -480,7 +480,11 @@ impl Tower {
|
||||
#[cfg(test)]
|
||||
pub mod test {
|
||||
use super::*;
|
||||
use crate::replay_stage::{ForkProgress, HeaviestForkFailures, ReplayStage};
|
||||
use crate::{
|
||||
cluster_info_vote_listener::VoteTracker,
|
||||
progress_map::ForkProgress,
|
||||
replay_stage::{HeaviestForkFailures, ReplayStage},
|
||||
};
|
||||
use solana_ledger::bank_forks::BankForks;
|
||||
use solana_runtime::{
|
||||
bank::Bank,
|
||||
@@ -523,7 +527,7 @@ pub mod test {
|
||||
cluster_votes: &mut HashMap<Pubkey, Vec<u64>>,
|
||||
validator_keypairs: &HashMap<Pubkey, ValidatorVoteKeypairs>,
|
||||
my_keypairs: &ValidatorVoteKeypairs,
|
||||
progress: &mut HashMap<u64, ForkProgress>,
|
||||
progress: &mut ProgressMap,
|
||||
tower: &mut Tower,
|
||||
) -> Vec<HeaviestForkFailures> {
|
||||
let node = self
|
||||
@@ -562,7 +566,7 @@ pub mod test {
|
||||
info!("parent of {} is {}", missing_slot, parent_bank.slot(),);
|
||||
progress
|
||||
.entry(missing_slot)
|
||||
.or_insert_with(|| ForkProgress::new(parent_bank.last_blockhash()));
|
||||
.or_insert_with(|| ForkProgress::new(parent_bank.last_blockhash(), None, None));
|
||||
|
||||
// Create the missing bank
|
||||
let new_bank =
|
||||
@@ -607,6 +611,9 @@ pub mod test {
|
||||
&mut frozen_banks,
|
||||
tower,
|
||||
progress,
|
||||
&VoteTracker::default(),
|
||||
bank_forks,
|
||||
&mut HashSet::new(),
|
||||
);
|
||||
|
||||
let bank = bank_forks
|
||||
@@ -633,7 +640,14 @@ pub mod test {
|
||||
}
|
||||
let vote = tower.new_vote_from_bank(&bank, &my_vote_pubkey).0;
|
||||
if let Some(new_root) = tower.record_bank_vote(vote) {
|
||||
ReplayStage::handle_new_root(new_root, bank_forks, progress, &None, &mut 0);
|
||||
ReplayStage::handle_new_root(
|
||||
new_root,
|
||||
bank_forks,
|
||||
progress,
|
||||
&None,
|
||||
&mut 0,
|
||||
&mut HashSet::new(),
|
||||
);
|
||||
}
|
||||
|
||||
// Mark the vote for this bank under this node's pubkey so it will be
|
||||
@@ -687,7 +701,7 @@ pub mod test {
|
||||
pub(crate) fn initialize_state(
|
||||
validator_keypairs_map: &HashMap<Pubkey, ValidatorVoteKeypairs>,
|
||||
stake: u64,
|
||||
) -> (BankForks, HashMap<u64, ForkProgress>) {
|
||||
) -> (BankForks, ProgressMap) {
|
||||
let validator_keypairs: Vec<_> = validator_keypairs_map.values().collect();
|
||||
let GenesisConfigInfo {
|
||||
genesis_config,
|
||||
@@ -702,8 +716,8 @@ pub mod test {
|
||||
}
|
||||
|
||||
bank0.freeze();
|
||||
let mut progress = HashMap::new();
|
||||
progress.insert(0, ForkProgress::new(bank0.last_blockhash()));
|
||||
let mut progress = ProgressMap::default();
|
||||
progress.insert(0, ForkProgress::new(bank0.last_blockhash(), None, None));
|
||||
(BankForks::new(0, bank0), progress)
|
||||
}
|
||||
|
||||
@@ -735,7 +749,7 @@ pub mod test {
|
||||
bank_forks: &RwLock<BankForks>,
|
||||
cluster_votes: &mut HashMap<Pubkey, Vec<u64>>,
|
||||
keypairs: &HashMap<Pubkey, ValidatorVoteKeypairs>,
|
||||
progress: &mut HashMap<u64, ForkProgress>,
|
||||
progress: &mut ProgressMap,
|
||||
) -> bool {
|
||||
// Check that within some reasonable time, validator can make a new
|
||||
// root on this fork
|
||||
|
Reference in New Issue
Block a user