diff --git a/program-test/src/lib.rs b/program-test/src/lib.rs index 73434a9436..3bda2f9b26 100644 --- a/program-test/src/lib.rs +++ b/program-test/src/lib.rs @@ -387,6 +387,14 @@ impl Default for ProgramTest { } } +// Values returned by `ProgramTest::start` +pub struct StartOutputs { + pub banks_client: BanksClient, + pub payer: Keypair, + pub recent_blockhash: Hash, + pub rent: Rent, +} + impl ProgramTest { pub fn new( program_name: &str, @@ -536,7 +544,7 @@ impl ProgramTest { /// /// Returns a `BanksClient` interface into the test environment as well as a payer `Keypair` /// with SOL for sending transactions - pub async fn start(self) -> (BanksClient, Keypair, Hash) { + pub async fn start(self) -> StartOutputs { { use std::sync::Once; static ONCE: Once = Once::new(); @@ -555,7 +563,8 @@ impl ProgramTest { bootstrap_validator_stake_lamports, ); let mut genesis_config = gci.genesis_config; - genesis_config.rent = Rent::default(); + let rent = Rent::default(); + genesis_config.rent = rent; genesis_config.fee_rate_governor = solana_program::fee_calculator::FeeRateGovernor::default(); let payer = gci.mint_keypair; @@ -607,6 +616,11 @@ impl ProgramTest { .unwrap_or_else(|err| panic!("Failed to start banks client: {}", err)); let recent_blockhash = banks_client.get_recent_blockhash().await.unwrap(); - (banks_client, payer, recent_blockhash) + StartOutputs { + banks_client, + payer, + recent_blockhash, + rent, + } } }