Allow fork choice to support multiple versions of a slot (#16266)
This commit is contained in:
@@ -197,8 +197,9 @@ impl Tower {
|
||||
);
|
||||
let root = root_bank.slot();
|
||||
|
||||
let (best_slot, best_hash) = heaviest_subtree_fork_choice.best_overall_slot();
|
||||
let heaviest_bank = bank_forks
|
||||
.get(heaviest_subtree_fork_choice.best_overall_slot())
|
||||
.get_with_checked_hash((best_slot, best_hash))
|
||||
.expect(
|
||||
"The best overall slot must be one of `frozen_banks` which all exist in bank_forks",
|
||||
)
|
||||
@@ -436,6 +437,10 @@ impl Tower {
|
||||
self.last_vote.last_voted_slot()
|
||||
}
|
||||
|
||||
pub fn last_voted_slot_hash(&self) -> Option<(Slot, Hash)> {
|
||||
self.last_vote.last_voted_slot_hash()
|
||||
}
|
||||
|
||||
pub fn stray_restored_slot(&self) -> Option<Slot> {
|
||||
self.stray_restored_slot
|
||||
}
|
||||
@@ -1372,8 +1377,10 @@ pub mod test {
|
||||
}
|
||||
}
|
||||
new_bank.freeze();
|
||||
self.heaviest_subtree_fork_choice
|
||||
.add_new_leaf_slot(new_bank.slot(), Some(new_bank.parent_slot()));
|
||||
self.heaviest_subtree_fork_choice.add_new_leaf_slot(
|
||||
(new_bank.slot(), new_bank.hash()),
|
||||
Some((new_bank.parent_slot(), new_bank.parent_hash())),
|
||||
);
|
||||
self.bank_forks.write().unwrap().insert(new_bank);
|
||||
walk.forward();
|
||||
}
|
||||
|
Reference in New Issue
Block a user