add _for_tests to new_no_wallclock_throttle (#19086)

This commit is contained in:
Jeff Washington (jwash) 2021-08-05 14:50:25 -05:00 committed by GitHub
parent a9014ceceb
commit e368f10973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 16 deletions

View File

@ -1591,7 +1591,7 @@ mod tests {
#[test] #[test]
fn test_banking_stage_shutdown1() { fn test_banking_stage_shutdown1() {
let genesis_config = create_genesis_config(2).genesis_config; let genesis_config = create_genesis_config(2).genesis_config;
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let (verified_sender, verified_receiver) = unbounded(); let (verified_sender, verified_receiver) = unbounded();
let (vote_sender, vote_receiver) = unbounded(); let (vote_sender, vote_receiver) = unbounded();
let (gossip_vote_sender, _gossip_vote_receiver) = unbounded(); let (gossip_vote_sender, _gossip_vote_receiver) = unbounded();
@ -1633,7 +1633,7 @@ mod tests {
} = create_genesis_config(2); } = create_genesis_config(2);
genesis_config.ticks_per_slot = 4; genesis_config.ticks_per_slot = 4;
let num_extra_ticks = 2; let num_extra_ticks = 2;
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let start_hash = bank.last_blockhash(); let start_hash = bank.last_blockhash();
let (verified_sender, verified_receiver) = unbounded(); let (verified_sender, verified_receiver) = unbounded();
let (vote_sender, vote_receiver) = unbounded(); let (vote_sender, vote_receiver) = unbounded();
@ -1703,7 +1703,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_slow_genesis_config(10); } = create_slow_genesis_config(10);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let start_hash = bank.last_blockhash(); let start_hash = bank.last_blockhash();
let (verified_sender, verified_receiver) = unbounded(); let (verified_sender, verified_receiver) = unbounded();
let (vote_sender, vote_receiver) = unbounded(); let (vote_sender, vote_receiver) = unbounded();
@ -1781,7 +1781,7 @@ mod tests {
drop(poh_recorder); drop(poh_recorder);
let mut blockhash = start_hash; let mut blockhash = start_hash;
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
bank.process_transaction(&fund_tx).unwrap(); bank.process_transaction(&fund_tx).unwrap();
//receive entries + ticks //receive entries + ticks
loop { loop {
@ -1859,7 +1859,7 @@ mod tests {
let entry_receiver = { let entry_receiver = {
// start a banking_stage to eat verified receiver // start a banking_stage to eat verified receiver
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let blockstore = Arc::new( let blockstore = Arc::new(
Blockstore::open(&ledger_path) Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger"), .expect("Expected to be able to open database ledger"),
@ -1905,7 +1905,7 @@ mod tests {
.map(|(_bank, (entry, _tick_height))| entry) .map(|(_bank, (entry, _tick_height))| entry)
.collect(); .collect();
let bank = Bank::new_no_wallclock_throttle(&genesis_config); let bank = Bank::new_no_wallclock_throttle_for_tests(&genesis_config);
for entry in &entries { for entry in &entries {
bank.process_transactions(entry.transactions.iter()) bank.process_transactions(entry.transactions.iter())
.iter() .iter()
@ -1929,7 +1929,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_genesis_config(10_000); } = create_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let start = Arc::new(Instant::now()); let start = Arc::new(Instant::now());
let working_bank = WorkingBank { let working_bank = WorkingBank {
bank: bank.clone(), bank: bank.clone(),
@ -2193,7 +2193,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_slow_genesis_config(10_000); } = create_slow_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let pubkey = solana_sdk::pubkey::new_rand(); let pubkey = solana_sdk::pubkey::new_rand();
let transactions = let transactions =
@ -2326,7 +2326,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_slow_genesis_config(10_000); } = create_slow_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let pubkey = solana_sdk::pubkey::new_rand(); let pubkey = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand(); let pubkey1 = solana_sdk::pubkey::new_rand();
@ -2442,7 +2442,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_slow_genesis_config(10_000); } = create_slow_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let pubkey = solana_sdk::pubkey::new_rand(); let pubkey = solana_sdk::pubkey::new_rand();
@ -2509,7 +2509,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_slow_genesis_config(10_000); } = create_slow_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let pubkey = solana_sdk::pubkey::new_rand(); let pubkey = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand(); let pubkey1 = solana_sdk::pubkey::new_rand();
let keypair1 = Keypair::new(); let keypair1 = Keypair::new();
@ -2645,7 +2645,7 @@ mod tests {
} = &genesis_config_info; } = &genesis_config_info;
let blockstore = let blockstore =
Blockstore::open(ledger_path).expect("Expected to be able to open database ledger"); Blockstore::open(ledger_path).expect("Expected to be able to open database ledger");
let bank = Arc::new(Bank::new_no_wallclock_throttle(genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(genesis_config));
let exit = Arc::new(AtomicBool::default()); let exit = Arc::new(AtomicBool::default());
let (poh_recorder, entry_receiver, record_receiver) = PohRecorder::new( let (poh_recorder, entry_receiver, record_receiver) = PohRecorder::new(
bank.tick_height(), bank.tick_height(),

View File

@ -247,7 +247,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_genesis_config(10); } = create_genesis_config(10);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let start_hash = bank.last_blockhash(); let start_hash = bank.last_blockhash();
(mint_keypair, start_hash) (mint_keypair, start_hash)
} }

View File

@ -176,7 +176,7 @@ mod tests {
mint_keypair, mint_keypair,
.. ..
} = create_genesis_config(10); } = create_genesis_config(10);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let start_hash = bank.last_blockhash(); let start_hash = bank.last_blockhash();
(mint_keypair, start_hash) (mint_keypair, start_hash)
} }

View File

@ -377,7 +377,7 @@ mod tests {
fn test_poh_service() { fn test_poh_service() {
solana_logger::setup(); solana_logger::setup();
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2); let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank = Arc::new(Bank::new_no_wallclock_throttle(&genesis_config)); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let prev_hash = bank.last_blockhash(); let prev_hash = bank.last_blockhash();
let ledger_path = get_tmp_ledger_path!(); let ledger_path = get_tmp_ledger_path!();
{ {

View File

@ -1072,7 +1072,7 @@ impl Bank {
) )
} }
pub fn new_no_wallclock_throttle(genesis_config: &GenesisConfig) -> Self { pub fn new_no_wallclock_throttle_for_tests(genesis_config: &GenesisConfig) -> Self {
let mut bank = Self::new_with_paths( let mut bank = Self::new_with_paths(
genesis_config, genesis_config,
Vec::new(), Vec::new(),