Skip to content

Commit

Permalink
Make test_bank_cloned_stake_delegations() aware of stake minimum dele…
Browse files Browse the repository at this point in the history
…gation
  • Loading branch information
brooksprumo committed Apr 27, 2022
1 parent 71ad121 commit 9d547ba
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11362,13 +11362,21 @@ pub(crate) mod tests {
genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(500, &solana_sdk::pubkey::new_rand(), 1);
} = create_genesis_config_with_leader(10_000_000_000, &solana_sdk::pubkey::new_rand(), 1);
let bank = Arc::new(Bank::new_for_tests(&genesis_config));

let stake_delegations = bank.stakes_cache.stakes().stake_delegations().clone();
assert_eq!(stake_delegations.len(), 1); // bootstrap validator has
// to have a stake delegation

let balance = {
let rent = &bank.rent_collector().rent;
let rent_exempt_reserve = rent.minimum_balance(StakeState::size_of());
let minimum_delegation =
solana_stake_program::get_minimum_delegation(&bank.feature_set);
rent_exempt_reserve + minimum_delegation
};

let vote_keypair = Keypair::new();
let mut instructions = vote_instruction::create_account(
&mint_keypair.pubkey(),
Expand All @@ -11379,7 +11387,7 @@ pub(crate) mod tests {
authorized_withdrawer: vote_keypair.pubkey(),
commission: 0,
},
10,
balance,
);

let stake_keypair = Keypair::new();
Expand All @@ -11389,7 +11397,7 @@ pub(crate) mod tests {
&vote_keypair.pubkey(),
&Authorized::auto(&stake_keypair.pubkey()),
&Lockup::default(),
10,
balance,
));

let message = Message::new(&instructions, Some(&mint_keypair.pubkey()));
Expand Down

0 comments on commit 9d547ba

Please sign in to comment.