Bank::default_for_tests() (#19084)
This commit is contained in:
parent
24207a09ac
commit
a9014ceceb
|
@ -106,7 +106,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_rpc_banks_server_exit() {
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(Bank::default())));
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(Bank::default_for_tests())));
|
||||
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let addr = "127.0.0.1:0".parse().unwrap();
|
||||
|
|
|
@ -189,7 +189,7 @@ mod test {
|
|||
#[test]
|
||||
fn service_exit() {
|
||||
let tpu_address = "127.0.0.1:0".parse().unwrap();
|
||||
let bank = Bank::default();
|
||||
let bank = Bank::default_for_tests();
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let (sender, receiver) = channel();
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ fn bench_save_tower(bench: &mut Bencher) {
|
|||
|
||||
let vote_account_pubkey = &Pubkey::default();
|
||||
let node_keypair = Arc::new(Keypair::new());
|
||||
let heaviest_bank = BankForks::new(Bank::default()).working_bank();
|
||||
let heaviest_bank = BankForks::new(Bank::default_for_tests()).working_bank();
|
||||
let tower = Tower::new(
|
||||
&node_keypair.pubkey(),
|
||||
vote_account_pubkey,
|
||||
|
@ -47,7 +47,7 @@ fn bench_generate_ancestors_descendants(bench: &mut Bencher) {
|
|||
|
||||
let vote_account_pubkey = &Pubkey::default();
|
||||
let node_keypair = Arc::new(Keypair::new());
|
||||
let heaviest_bank = BankForks::new(Bank::default()).working_bank();
|
||||
let heaviest_bank = BankForks::new(Bank::default_for_tests()).working_bank();
|
||||
let mut tower = Tower::new(
|
||||
&node_keypair.pubkey(),
|
||||
vote_account_pubkey,
|
||||
|
|
|
@ -2101,7 +2101,7 @@ mod tests {
|
|||
fn test_should_process_or_forward_packets() {
|
||||
let my_pubkey = solana_sdk::pubkey::new_rand();
|
||||
let my_pubkey1 = solana_sdk::pubkey::new_rand();
|
||||
let bank = Arc::new(Bank::default());
|
||||
let bank = Arc::new(Bank::default_for_tests());
|
||||
assert_matches!(
|
||||
BankingStage::consume_or_forward_packets(&my_pubkey, None, Some(&bank), false, false),
|
||||
BufferedPacketsDecision::Hold
|
||||
|
|
|
@ -6854,7 +6854,7 @@ pub mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_is_finalized() {
|
||||
let bank = Arc::new(Bank::default());
|
||||
let bank = Arc::new(Bank::default_for_tests());
|
||||
let ledger_path = get_tmp_ledger_path!();
|
||||
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
|
||||
blockstore.set_roots(vec![0, 1].iter()).unwrap();
|
||||
|
|
|
@ -340,7 +340,7 @@ mod test {
|
|||
#[test]
|
||||
fn service_exit() {
|
||||
let tpu_address = "127.0.0.1:0".parse().unwrap();
|
||||
let bank = Bank::default();
|
||||
let bank = Bank::default_for_tests();
|
||||
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
|
||||
let (sender, receiver) = channel();
|
||||
|
||||
|
|
|
@ -1047,6 +1047,11 @@ impl Default for BlockhashQueue {
|
|||
}
|
||||
|
||||
impl Bank {
|
||||
pub fn default_for_tests() -> Self {
|
||||
// will diverge
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn new_for_benches(genesis_config: &GenesisConfig) -> Self {
|
||||
// this will diverge
|
||||
Self::new_for_tests(genesis_config)
|
||||
|
|
Loading…
Reference in New Issue