// Setup BankForks with bank 0 and all the validator accounts
Setup BankForks with bank 0 and all the validator accounts
Setup BankForks with bank 0 and all the validator accounts
pub(crate) fn initialize_state(
        validator_keypairs_map: &HashMap<Pubkey, ValidatorVoteKeypairs>,
        stake: u64,
    ) -> (BankForks, ProgressMap, HeaviestSubtreeForkChoice) {
        let validator_keypairs: Vec<_> = validator_keypairs_map.values().collect();
        let GenesisConfigInfo {
            genesis_config,
            mint_keypair,
            voting_keypair: _,
        } = create_genesis_config_with_vote_accounts(
            1_000_000_000,
            &validator_keypairs,
            vec![stake; validator_keypairs.len()],
        );
        let bank0 = Bank::new(&genesis_config);
        for pubkey in validator_keypairs_map.keys() {
            bank0.transfer(10_000, &mint_keypair, pubkey).unwrap();
        }
        bank0.freeze();
        let mut progress = ProgressMap::default();
        progress.insert(
            0,
            ForkProgress::new(bank0.last_blockhash(), None, None, 0, 0),
        );
        let bank_forks = BankForks::new(bank0);
        let heaviest_subtree_fork_choice =
            HeaviestSubtreeForkChoice::new_from_bank_forks(&bank_forks);
        (bank_forks, progress, heaviest_subtree_fork_choice)
    }
pub ( crate ) fn initialize_state ( validator_keypairs_map : & HashMap < Pubkey , ValidatorVoteKeypairs > , stake : u64 , ) -> ( BankForks , ProgressMap , HeaviestSubtreeForkChoice ) { let validator_keypairs : Vec < _ > = validator_keypairs_map . values ( ) . collect ( ) ; let GenesisConfigInfo { genesis_config , mint_keypair , voting_keypair : _ , } = create_genesis_config_with_vote_accounts ( 1_000_000_000 , & validator_keypairs , vec ! [ stake validator_keypairs len ( ) ] , ) ; let bank0 = Bank :: new ( & genesis_config ) ; for pubkey in validator_keypairs_map . keys ( ) { bank0 . transfer ( 10_000 , & mint_keypair , pubkey ) . unwrap ( ) ; } bank0 . freeze ( ) ; let mut progress = ProgressMap :: default ( ) ; progress . insert ( 0 , ForkProgress :: new ( bank0 . last_blockhash ( ) , None , None , 0 , 0 ) , ) ; let bank_forks = BankForks :: new ( bank0 ) ; let heaviest_subtree_fork_choice = HeaviestSubtreeForkChoice :: new_from_bank_forks ( & bank_forks ) ; ( bank_forks , progress , heaviest_subtree_fork_choice ) }
Setup BankForks with bank 0 and all the validator accounts
Setup BankForks with bank 0 and all the validator accounts
validator_keypairs_map
&HashMap<Pubkey, ValidatorVoteKeypairs>
stake
u64