Repair alternate versions of dead slots (#9805)

Co-authored-by: Carl <carl@solana.com>
This commit is contained in:
carllin
2020-05-05 14:07:21 -07:00
committed by GitHub
parent b2672fd623
commit 3442f36f8a
17 changed files with 1246 additions and 122 deletions

View File

@@ -172,6 +172,23 @@ impl<T: Clone> AccountsIndex<T> {
}
}
pub fn clean_unrooted_entries_by_slot(
&self,
purge_slot: Slot,
pubkey: &Pubkey,
reclaims: &mut SlotList<T>,
) {
if let Some(entry) = self.account_maps.get(pubkey) {
let mut list = entry.1.write().unwrap();
list.retain(|(slot, entry)| {
if *slot == purge_slot {
reclaims.push((*slot, entry.clone()));
}
*slot != purge_slot
});
}
}
pub fn add_index(&mut self, slot: Slot, pubkey: &Pubkey, account_info: T) {
let entry = self
.account_maps