Skip to content

Commit

Permalink
Remove redundant code from Bank::wrap_with_bank_forks_for_tests() (#3…
Browse files Browse the repository at this point in the history
…4448)

The same initialization occurs when the Bank is inserted into a new
BankForks, so no need to duplicate the logic in this test function
  • Loading branch information
steviez authored Dec 14, 2023
1 parent d36b211 commit fe7970c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8166,14 +8166,9 @@ impl Bank {
#[cfg(feature = "dev-context-only-utils")]
impl Bank {
pub fn wrap_with_bank_forks_for_tests(self) -> (Arc<Self>, Arc<RwLock<BankForks>>) {
let bank_fork = BankForks::new_rw_arc(self);
let bank_arc = bank_fork.read().unwrap().root_bank();
bank_arc
.loaded_programs_cache
.write()
.unwrap()
.set_fork_graph(bank_fork.clone());
(bank_arc, bank_fork)
let bank_forks = BankForks::new_rw_arc(self);
let bank = bank_forks.read().unwrap().root_bank();
(bank, bank_forks)
}

pub fn default_for_tests() -> Self {
Expand Down

0 comments on commit fe7970c

Please sign in to comment.