Add find_incomplete_slots (#8654)

* Add find_incomplete_slots

* Add live slots iterator
This commit is contained in:
carllin
2020-03-05 10:58:00 -08:00
committed by GitHub
parent 5e3ce30d02
commit f47a789b15
2 changed files with 86 additions and 1 deletions

View File

@ -11,6 +11,7 @@ use crate::{
entry::{create_ticks, Entry},
erasure::ErasureConfig,
leader_schedule_cache::LeaderScheduleCache,
next_slots_iterator::NextSlotsIterator,
rooted_slot_iterator::RootedSlotIterator,
shred::{Shred, Shredder},
};
@ -437,6 +438,17 @@ impl Blockstore {
}))
}
#[allow(dead_code)]
pub fn live_slots_iterator<'a>(
&'a self,
root: Slot,
) -> impl Iterator<Item = (Slot, SlotMeta)> + 'a {
let root_forks = NextSlotsIterator::new(root, self);
let orphans_iter = self.orphans_iterator(root + 1).unwrap();
root_forks.chain(orphans_iter.flat_map(move |orphan| NextSlotsIterator::new(orphan, self)))
}
pub fn slot_data_iterator<'a>(
&'a self,
slot: Slot,