Struct solana_program_test::ProgramTestContext
source · pub struct ProgramTestContext {
pub banks_client: BanksClient,
pub last_blockhash: Hash,
pub payer: Keypair,
/* private fields */
}
Fields§
§banks_client: BanksClient
§last_blockhash: Hash
§payer: Keypair
Implementations§
source§impl ProgramTestContext
impl ProgramTestContext
pub fn genesis_config(&self) -> &GenesisConfig
sourcepub fn increment_vote_account_credits(
&mut self,
vote_account_address: &Pubkey,
number_of_credits: u64
)
pub fn increment_vote_account_credits( &mut self, vote_account_address: &Pubkey, number_of_credits: u64 )
Manually increment vote credits for the current epoch in the specified vote account to simulate validator voting activity
sourcepub fn set_account(&mut self, address: &Pubkey, account: &AccountSharedData)
pub fn set_account(&mut self, address: &Pubkey, account: &AccountSharedData)
Create or overwrite an account, subverting normal runtime checks.
This method exists to make it easier to set up artificial situations that would be difficult to replicate by sending individual transactions. Beware that it can be used to create states that would not be reachable by sending transactions!
sourcepub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T)
pub fn set_sysvar<T: SysvarId + Sysvar>(&self, sysvar: &T)
Create or overwrite a sysvar, subverting normal runtime checks.
This method exists to make it easier to set up artificial situations that would be difficult to replicate on a new test cluster. Beware that it can be used to create states that would not be reachable under normal conditions!
sourcepub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError>
pub fn warp_to_slot(&mut self, warp_slot: Slot) -> Result<(), ProgramTestError>
Force the working bank ahead to a new slot