Include Rent in ProgramTest::start() output (#13356)
(cherry picked from commit c3d2d2134c
)
Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
@ -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 {
|
impl ProgramTest {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
program_name: &str,
|
program_name: &str,
|
||||||
@ -536,7 +544,7 @@ impl ProgramTest {
|
|||||||
///
|
///
|
||||||
/// Returns a `BanksClient` interface into the test environment as well as a payer `Keypair`
|
/// Returns a `BanksClient` interface into the test environment as well as a payer `Keypair`
|
||||||
/// with SOL for sending transactions
|
/// with SOL for sending transactions
|
||||||
pub async fn start(self) -> (BanksClient, Keypair, Hash) {
|
pub async fn start(self) -> StartOutputs {
|
||||||
{
|
{
|
||||||
use std::sync::Once;
|
use std::sync::Once;
|
||||||
static ONCE: Once = Once::new();
|
static ONCE: Once = Once::new();
|
||||||
@ -555,7 +563,8 @@ impl ProgramTest {
|
|||||||
bootstrap_validator_stake_lamports,
|
bootstrap_validator_stake_lamports,
|
||||||
);
|
);
|
||||||
let mut genesis_config = gci.genesis_config;
|
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 =
|
genesis_config.fee_rate_governor =
|
||||||
solana_program::fee_calculator::FeeRateGovernor::default();
|
solana_program::fee_calculator::FeeRateGovernor::default();
|
||||||
let payer = gci.mint_keypair;
|
let payer = gci.mint_keypair;
|
||||||
@ -607,6 +616,11 @@ impl ProgramTest {
|
|||||||
.unwrap_or_else(|err| panic!("Failed to start banks client: {}", err));
|
.unwrap_or_else(|err| panic!("Failed to start banks client: {}", err));
|
||||||
|
|
||||||
let recent_blockhash = banks_client.get_recent_blockhash().await.unwrap();
|
let recent_blockhash = banks_client.get_recent_blockhash().await.unwrap();
|
||||||
(banks_client, payer, recent_blockhash)
|
StartOutputs {
|
||||||
|
banks_client,
|
||||||
|
payer,
|
||||||
|
recent_blockhash,
|
||||||
|
rent,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user