Define register_unique_recent_blockhash_for_test (#33880)
This commit is contained in:
parent
080285cb95
commit
0873705c1b
|
@ -888,7 +888,7 @@ impl ProgramTest {
|
|||
.read()
|
||||
.unwrap()
|
||||
.working_bank()
|
||||
.register_recent_blockhash(&Hash::new_unique());
|
||||
.register_unique_recent_blockhash_for_test();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1040,7 +1040,7 @@ impl ProgramTestContext {
|
|||
.read()
|
||||
.unwrap()
|
||||
.working_bank()
|
||||
.register_recent_blockhash(&Hash::new_unique());
|
||||
.register_unique_recent_blockhash_for_test();
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
|
@ -4013,7 +4013,7 @@ fn test_cpi_account_ownership_writability() {
|
|||
TEST_FORBID_WRITE_AFTER_OWNERSHIP_CHANGE_IN_CALLEE,
|
||||
TEST_FORBID_WRITE_AFTER_OWNERSHIP_CHANGE_IN_CALLER,
|
||||
] {
|
||||
bank.register_recent_blockhash(&Hash::new_unique());
|
||||
bank.register_unique_recent_blockhash_for_test();
|
||||
let account = AccountSharedData::new(42, account_size, &invoke_program_id);
|
||||
bank.store_account(&account_keypair.pubkey(), &account);
|
||||
|
||||
|
|
|
@ -4186,6 +4186,12 @@ impl Bank {
|
|||
self.update_recent_blockhashes_locked(&w_blockhash_queue);
|
||||
}
|
||||
|
||||
// gating this under #[cfg(feature = "dev-context-only-utils")] isn't easy due to
|
||||
// solana-program-test's usage...
|
||||
pub fn register_unique_recent_blockhash_for_test(&self) {
|
||||
self.register_recent_blockhash(&Hash::new_unique())
|
||||
}
|
||||
|
||||
/// Tell the bank which Entry IDs exist on the ledger. This function assumes subsequent calls
|
||||
/// correspond to later entries, and will boot the oldest ones once its internal cache is full.
|
||||
/// Once boot, the bank will reject transactions using that `hash`.
|
||||
|
|
|
@ -13373,7 +13373,7 @@ fn test_program_execution_restricted_for_stake_account_in_reward_period() {
|
|||
// Push a dummy blockhash, so that the latest_blockhash() for the transfer transaction in each
|
||||
// iteration are different. Otherwise, all those transactions will be the same, and will not be
|
||||
// executed by the bank except the first one.
|
||||
bank.register_recent_blockhash(&Hash::new_unique());
|
||||
bank.register_unique_recent_blockhash_for_test();
|
||||
previous_bank = Arc::new(bank);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue