Skip to content

Commit

Permalink
Fixup RPC subscription test
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Apr 27, 2022
1 parent e7d8542 commit 9ef43cd
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions rpc/src/rpc_pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ mod tests {
bank_forks::BankForks,
commitment::{BlockCommitmentCache, CommitmentSlots},
genesis_utils::{
create_genesis_config, create_genesis_config_with_vote_accounts, GenesisConfigInfo,
ValidatorVoteKeypairs,
activate_all_features, create_genesis_config,
create_genesis_config_with_vote_accounts, GenesisConfigInfo, ValidatorVoteKeypairs,
},
vote_transaction::VoteTransaction,
},
Expand All @@ -604,6 +604,7 @@ mod tests {
hash::Hash,
message::Message,
pubkey::Pubkey,
rent::Rent,
signature::{Keypair, Signer},
stake::{
self, instruction as stake_instruction,
Expand Down Expand Up @@ -825,10 +826,12 @@ mod tests {
#[serial]
fn test_account_subscribe() {
let GenesisConfigInfo {
genesis_config,
mut genesis_config,
mint_keypair: alice,
..
} = create_genesis_config(10_000_000_000);
genesis_config.rent = Rent::default();
activate_all_features(&mut genesis_config);

let new_stake_authority = solana_sdk::pubkey::new_rand();
let stake_authority = Keypair::new();
Expand Down Expand Up @@ -875,10 +878,7 @@ mod tests {
let balance = {
let bank = bank_forks.read().unwrap().working_bank();
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
rent.minimum_balance(StakeState::size_of())
};

let tx = system_transaction::transfer(&alice, &from.pubkey(), balance, blockhash);
Expand Down Expand Up @@ -928,7 +928,13 @@ mod tests {
serde_json::from_str::<serde_json::Value>(&response).unwrap(),
);

let tx = system_transaction::transfer(&alice, &stake_authority.pubkey(), 1, blockhash);
let balance = {
let bank = bank_forks.read().unwrap().working_bank();
let rent = &bank.rent_collector().rent;
rent.minimum_balance(0)
};
let tx =
system_transaction::transfer(&alice, &stake_authority.pubkey(), balance, blockhash);
process_transaction_and_notify(&bank_forks, &tx, &rpc_subscriptions, 1).unwrap();
sleep(Duration::from_millis(200));
let ix = stake_instruction::authorize(
Expand Down

0 comments on commit 9ef43cd

Please sign in to comment.