Skip to content

Commit

Permalink
Simplify Arc<Bank> handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Nov 3, 2023
1 parent d4aee43 commit 5df66e0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions runtime/src/installed_scheduler_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ mod tests {
};

fn setup_mocked_scheduler_with_extra(
bank: &Arc<Bank>,
bank: Arc<Bank>,
wait_reasons: impl Iterator<Item = WaitReason>,
f: Option<impl Fn(&mut MockInstalledScheduler)>,
) -> DefaultInstalledSchedulerBox {
Expand All @@ -423,7 +423,7 @@ mod tests {
mock.expect_context()
.times(1)
.in_sequence(&mut seq)
.return_const(SchedulingContext::new(bank.clone()));
.return_const(SchedulingContext::new(bank));

for wait_reason in wait_reasons {
mock.expect_wait_for_termination()
Expand Down Expand Up @@ -451,7 +451,7 @@ mod tests {
}

fn setup_mocked_scheduler(
bank: &Arc<Bank>,
bank: Arc<Bank>,
wait_reasons: impl Iterator<Item = WaitReason>,
) -> DefaultInstalledSchedulerBox {
setup_mocked_scheduler_with_extra(
Expand All @@ -465,7 +465,7 @@ mod tests {
fn test_scheduler_normal_termination() {
solana_logger::setup();

let bank = &Arc::new(Bank::default_for_tests());
let bank = Arc::new(Bank::default_for_tests());
let bank = BankWithScheduler::new(
bank.clone(),
Some(setup_mocked_scheduler(
Expand Down Expand Up @@ -498,7 +498,7 @@ mod tests {
fn test_scheduler_termination_from_drop() {
solana_logger::setup();

let bank = &Arc::new(Bank::default_for_tests());
let bank = Arc::new(Bank::default_for_tests());
let bank = BankWithScheduler::new(
bank.clone(),
Some(setup_mocked_scheduler(
Expand All @@ -513,7 +513,7 @@ mod tests {
fn test_scheduler_pause() {
solana_logger::setup();

let bank = &Arc::new(crate::bank::tests::create_simple_test_bank(42));
let bank = Arc::new(crate::bank::tests::create_simple_test_bank(42));
let bank = BankWithScheduler::new(
bank.clone(),
Some(setup_mocked_scheduler(
Expand Down Expand Up @@ -546,7 +546,7 @@ mod tests {
));
let bank = Arc::new(Bank::new_for_tests(&genesis_config));
let mocked_scheduler = setup_mocked_scheduler_with_extra(
&bank,
bank.clone(),
[WaitReason::DroppedFromBankForks].into_iter(),
Some(|mocked: &mut MockInstalledScheduler| {
mocked
Expand Down

0 comments on commit 5df66e0

Please sign in to comment.