This repository was archived by the owner on Jan 22, 2025. It is now read-only.
File tree 4 files changed +10
-4
lines changed 4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -888,7 +888,7 @@ impl ProgramTest {
888
888
. read ( )
889
889
. unwrap ( )
890
890
. working_bank ( )
891
- . register_recent_blockhash ( & Hash :: new_unique ( ) ) ;
891
+ . register_unique_recent_blockhash_for_test ( ) ;
892
892
}
893
893
} ) ;
894
894
@@ -1040,7 +1040,7 @@ impl ProgramTestContext {
1040
1040
. read ( )
1041
1041
. unwrap ( )
1042
1042
. working_bank ( )
1043
- . register_recent_blockhash ( & Hash :: new_unique ( ) ) ;
1043
+ . register_unique_recent_blockhash_for_test ( ) ;
1044
1044
}
1045
1045
} ) ,
1046
1046
) ;
Original file line number Diff line number Diff line change @@ -4013,7 +4013,7 @@ fn test_cpi_account_ownership_writability() {
4013
4013
TEST_FORBID_WRITE_AFTER_OWNERSHIP_CHANGE_IN_CALLEE ,
4014
4014
TEST_FORBID_WRITE_AFTER_OWNERSHIP_CHANGE_IN_CALLER ,
4015
4015
] {
4016
- bank. register_recent_blockhash ( & Hash :: new_unique ( ) ) ;
4016
+ bank. register_unique_recent_blockhash_for_test ( ) ;
4017
4017
let account = AccountSharedData :: new ( 42 , account_size, & invoke_program_id) ;
4018
4018
bank. store_account ( & account_keypair. pubkey ( ) , & account) ;
4019
4019
Original file line number Diff line number Diff line change @@ -4186,6 +4186,12 @@ impl Bank {
4186
4186
self . update_recent_blockhashes_locked ( & w_blockhash_queue) ;
4187
4187
}
4188
4188
4189
+ // gating this under #[cfg(feature = "dev-context-only-utils")] isn't easy due to
4190
+ // solana-program-test's usage...
4191
+ pub fn register_unique_recent_blockhash_for_test ( & self ) {
4192
+ self . register_recent_blockhash ( & Hash :: new_unique ( ) )
4193
+ }
4194
+
4189
4195
/// Tell the bank which Entry IDs exist on the ledger. This function assumes subsequent calls
4190
4196
/// correspond to later entries, and will boot the oldest ones once its internal cache is full.
4191
4197
/// Once boot, the bank will reject transactions using that `hash`.
Original file line number Diff line number Diff line change @@ -13373,7 +13373,7 @@ fn test_program_execution_restricted_for_stake_account_in_reward_period() {
13373
13373
// Push a dummy blockhash, so that the latest_blockhash() for the transfer transaction in each
13374
13374
// iteration are different. Otherwise, all those transactions will be the same, and will not be
13375
13375
// executed by the bank except the first one.
13376
- bank.register_recent_blockhash(&Hash::new_unique() );
13376
+ bank.register_unique_recent_blockhash_for_test( );
13377
13377
previous_bank = Arc::new(bank);
13378
13378
}
13379
13379
}
You can’t perform that action at this time.
0 commit comments