Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove too confusing insert_without_scheduler()
  • Loading branch information
ryoqun committed Oct 21, 2023
commit 0d5f0f001982a44d6a774ed688d99c233c3bd36b
16 changes: 10 additions & 6 deletions core/tests/epoch_accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,19 @@ fn test_epoch_accounts_hash_and_warping() {
let bank = bank_forks
.write()
.unwrap()
.insert_without_scheduler(Bank::warp_from_parent(
.insert(Bank::warp_from_parent(
bank,
&Pubkey::default(),
eah_stop_slot_in_next_epoch,
CalcAccountsHashDataSource::Storages,
));
))
.clone_without_scheduler();
let slot = bank.slot().checked_add(1).unwrap();
let bank = bank_forks
.write()
.unwrap()
.insert_without_scheduler(Bank::new_from_parent(bank, &Pubkey::default(), slot));
.insert(Bank::new_from_parent(bank, &Pubkey::default(), slot))
.clone_without_scheduler();
bank_forks.write().unwrap().set_root(
bank.slot(),
&test_environment
Expand All @@ -639,17 +641,19 @@ fn test_epoch_accounts_hash_and_warping() {
let bank = bank_forks
.write()
.unwrap()
.insert_without_scheduler(Bank::warp_from_parent(
.insert(Bank::warp_from_parent(
bank,
&Pubkey::default(),
eah_start_slot_in_next_epoch,
CalcAccountsHashDataSource::Storages,
));
))
.clone_without_scheduler();
let slot = bank.slot().checked_add(1).unwrap();
let bank = bank_forks
.write()
.unwrap()
.insert_without_scheduler(Bank::new_from_parent(bank, &Pubkey::default(), slot));
.insert(Bank::new_from_parent(bank, &Pubkey::default(), slot))
.clone_without_scheduler();
bank_forks.write().unwrap().set_root(
bank.slot(),
&test_environment
Expand Down
16 changes: 9 additions & 7 deletions program-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,13 +1129,15 @@ impl ProgramTestContext {
bank.freeze();
bank
} else {
bank_forks.insert_without_scheduler(Bank::warp_from_parent(
bank,
&Pubkey::default(),
pre_warp_slot,
// some warping tests cannot use the append vecs because of the sequence of adding roots and flushing
solana_accounts_db::accounts_db::CalcAccountsHashDataSource::IndexForTests,
))
bank_forks
.insert(Bank::warp_from_parent(
bank,
&Pubkey::default(),
pre_warp_slot,
// some warping tests cannot use the append vecs because of the sequence of adding roots and flushing
solana_accounts_db::accounts_db::CalcAccountsHashDataSource::IndexForTests,
))
.clone_without_scheduler()
};

let (snapshot_request_sender, snapshot_request_receiver) = crossbeam_channel::unbounded();
Expand Down
18 changes: 8 additions & 10 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4967,7 +4967,8 @@ pub mod tests {
.bank_forks
.write()
.unwrap()
.insert_without_scheduler(new_bank);
.insert(new_bank)
.clone_without_scheduler();
let parent = if i > 0 { roots[i - 1] } else { 0 };
fill_blockstore_slot_with_ticks(
&self.blockstore,
Expand Down Expand Up @@ -5005,15 +5006,12 @@ pub mod tests {

fn advance_bank_to_confirmed_slot(&self, slot: Slot) -> Arc<Bank> {
let parent_bank = self.working_bank();
let bank =
self.bank_forks
.write()
.unwrap()
.insert_without_scheduler(Bank::new_from_parent(
parent_bank,
&Pubkey::default(),
slot,
));
let bank = self
.bank_forks
.write()
.unwrap()
.insert(Bank::new_from_parent(parent_bank, &Pubkey::default(), slot))
.clone_without_scheduler();

let new_block_commitment = BlockCommitmentCache::new(
HashMap::new(),
Expand Down
6 changes: 0 additions & 6 deletions runtime/src/bank_forks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ impl BankForks {
self.insert(bank)
}

// gating this under #[cfg(feature = "dev-context-only-utils")] isn't easy due to
// solana-program-test's usage...
pub fn insert_without_scheduler(&mut self, bank: Bank) -> Arc<Bank> {
self.insert(bank).clone_without_scheduler()
}

pub fn remove(&mut self, slot: Slot) -> Option<Arc<Bank>> {
let bank = self.banks.remove(&slot)?;
for parent in bank.proper_ancestors() {
Expand Down