Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Avoid looping over banks again, we know there is only root_bank
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Czabaniuk committed Dec 14, 2023
1 parent 6a40a81 commit 9cac54c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions runtime/src/bank_forks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,11 @@ impl BankForks {
}

let mut descendants = HashMap::<_, HashSet<_>>::new();
for (slot, bank) in &banks {
descendants.entry(*slot).or_default();
for parent in bank.proper_ancestors() {
descendants.entry(parent).or_default().insert(*slot);
}
descendants.entry(root_slot).or_default();
for parent in root_bank.proper_ancestors() {
descendants.entry(parent).or_default().insert(root_slot);
}

let bank_forks = Arc::new(RwLock::new(Self {
root: Arc::new(AtomicSlot::new(root_slot)),
banks,
Expand Down

0 comments on commit 9cac54c

Please sign in to comment.