diff --git a/runtime/benches/bank.rs b/runtime/benches/bank.rs index 837f614d9a..d8b4af8e54 100644 --- a/runtime/benches/bank.rs +++ b/runtime/benches/bank.rs @@ -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, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index b86e556c23..8164f8bfe9 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -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(