Skip to content

Commit

Permalink
v1.16: Initialize LoadedPrograms::latest_root earlier (#34432)
Browse files Browse the repository at this point in the history
* Fixes BankForks::new_from_banks() not setting the root of LoadedPrograms.

---------

Co-authored-by: Alexander Meißner <[email protected]>
  • Loading branch information
alessandrod and Lichtso authored Dec 14, 2023
1 parent 3470119 commit 9cde446
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions runtime/src/bank_forks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl BankForks {
descendants.entry(parent).or_default().insert(*slot);
}
}
Self {
let bank_forks = Self {
root: Arc::new(AtomicSlot::new(root)),
banks,
descendants,
Expand All @@ -184,7 +184,17 @@ impl BankForks {
last_accounts_hash_slot: root,
in_vote_only_mode: Arc::new(AtomicBool::new(false)),
highest_slot_at_startup: 0,
}
};
let root_bank = bank_forks
.banks
.get(&root)
.expect("root bank didn't exist in bank_forks");
root_bank
.loaded_programs_cache
.write()
.unwrap()
.prune(&bank_forks, root);
bank_forks
}

pub fn insert(&mut self, mut bank: Bank) -> Arc<Bank> {
Expand Down

0 comments on commit 9cde446

Please sign in to comment.