Modify bank_forks to support squashing/filtering new root and also don't remove parents from bank_forks when inserting, otherwise we lose potential fork points when querying blocktree for child slots

This commit is contained in:
Carl
2019-03-18 16:04:36 -07:00
committed by Grimes
parent 89cc82c71b
commit b38e3bef01
4 changed files with 120 additions and 45 deletions

View File

@ -152,8 +152,14 @@ impl Locktower {
}
}
pub fn record_vote(&mut self, slot: u64) {
pub fn record_vote(&mut self, slot: u64) -> Option<u64> {
let root_slot = self.lockouts.root_slot;
self.lockouts.process_vote(Vote { slot });
if root_slot != self.lockouts.root_slot {
Some(self.lockouts.root_slot.unwrap())
} else {
None
}
}
pub fn calculate_weight(&self, stake_lockouts: &HashMap<u64, StakeLockout>) -> u128 {