move bank test fn to its test_utils mod (#24171)
This commit is contained in:
parent
f8628d39e0
commit
e14933c54d
|
@ -6,7 +6,11 @@ extern crate test;
|
|||
use {
|
||||
log::*,
|
||||
solana_program_runtime::invoke_context::InvokeContext,
|
||||
solana_runtime::{bank::*, bank_client::BankClient, loader_utils::create_invoke_instruction},
|
||||
solana_runtime::{
|
||||
bank::{test_utils::goto_end_of_slot, *},
|
||||
bank_client::BankClient,
|
||||
loader_utils::create_invoke_instruction,
|
||||
},
|
||||
solana_sdk::{
|
||||
client::{AsyncClient, SyncClient},
|
||||
clock::MAX_RECENT_BLOCKHASHES,
|
||||
|
|
|
@ -6811,14 +6811,18 @@ impl Drop for Bank {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn goto_end_of_slot(bank: &mut Bank) {
|
||||
let mut tick_hash = bank.last_blockhash();
|
||||
loop {
|
||||
tick_hash = hashv(&[tick_hash.as_ref(), &[42]]);
|
||||
bank.register_tick(&tick_hash);
|
||||
if tick_hash == bank.last_blockhash() {
|
||||
bank.freeze();
|
||||
return;
|
||||
/// utility function used for testing and benchmarking.
|
||||
pub mod test_utils {
|
||||
use {super::Bank, solana_sdk::hash::hashv};
|
||||
pub fn goto_end_of_slot(bank: &mut Bank) {
|
||||
let mut tick_hash = bank.last_blockhash();
|
||||
loop {
|
||||
tick_hash = hashv(&[tick_hash.as_ref(), &[42]]);
|
||||
bank.register_tick(&tick_hash);
|
||||
if tick_hash == bank.last_blockhash() {
|
||||
bank.freeze();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6880,6 +6884,7 @@ pub(crate) mod tests {
|
|||
},
|
||||
},
|
||||
std::{result, thread::Builder, time::Duration},
|
||||
test_utils::goto_end_of_slot,
|
||||
};
|
||||
|
||||
fn new_sanitized_message(
|
||||
|
|
Loading…
Reference in New Issue