introduce Bank::new_for_tests (#19062)
This commit is contained in:
committed by
GitHub
parent
ca14475085
commit
1ed12a07ab
@ -344,7 +344,7 @@ pub fn initialize_state(
|
|||||||
);
|
);
|
||||||
|
|
||||||
genesis_config.poh_config.hashes_per_tick = Some(2);
|
genesis_config.poh_config.hashes_per_tick = Some(2);
|
||||||
let bank0 = Bank::new(&genesis_config);
|
let bank0 = Bank::new_for_tests(&genesis_config);
|
||||||
|
|
||||||
for pubkey in validator_keypairs_map.keys() {
|
for pubkey in validator_keypairs_map.keys() {
|
||||||
bank0.transfer(10_000, &mint_keypair, pubkey).unwrap();
|
bank0.transfer(10_000, &mint_keypair, pubkey).unwrap();
|
||||||
|
@ -754,7 +754,7 @@ impl ProgramTest {
|
|||||||
debug!("Payer address: {}", mint_keypair.pubkey());
|
debug!("Payer address: {}", mint_keypair.pubkey());
|
||||||
debug!("Genesis config: {}", genesis_config);
|
debug!("Genesis config: {}", genesis_config);
|
||||||
|
|
||||||
let mut bank = Bank::new(&genesis_config);
|
let mut bank = Bank::new_for_tests(&genesis_config);
|
||||||
|
|
||||||
// Add loaders
|
// Add loaders
|
||||||
macro_rules! add_builtin {
|
macro_rules! add_builtin {
|
||||||
|
@ -1048,6 +1048,12 @@ impl Default for BlockhashQueue {
|
|||||||
|
|
||||||
impl Bank {
|
impl Bank {
|
||||||
pub fn new(genesis_config: &GenesisConfig) -> Self {
|
pub fn new(genesis_config: &GenesisConfig) -> Self {
|
||||||
|
// this will go away in a coming pr where many replacements in test code will get made
|
||||||
|
Self::new_for_tests(genesis_config)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_for_tests(genesis_config: &GenesisConfig) -> Self {
|
||||||
|
// this will diverge
|
||||||
Self::new_with_paths(
|
Self::new_with_paths(
|
||||||
genesis_config,
|
genesis_config,
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
|
@ -22,7 +22,7 @@ pub fn setup_bank_and_vote_pubkeys(num_vote_accounts: usize, stake: u64) -> (Ban
|
|||||||
&validator_voting_keypairs,
|
&validator_voting_keypairs,
|
||||||
vec![stake; validator_voting_keypairs.len()],
|
vec![stake; validator_voting_keypairs.len()],
|
||||||
);
|
);
|
||||||
let bank = Bank::new(&genesis_config);
|
let bank = Bank::new_for_tests(&genesis_config);
|
||||||
(bank, vote_pubkeys)
|
(bank, vote_pubkeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user