Remove redundant code from Bank::wrap_with_bank_forks_for_tests() (#34448)

The same initialization occurs when the Bank is inserted into a new
BankForks, so no need to duplicate the logic in this test function
This commit is contained in:
steviez 2023-12-13 19:43:02 -06:00 committed by GitHub
parent d36b211120
commit fe7970ce46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 8 deletions

View File

@ -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 {