Add find_incomplete_slots (#8654) (#8671)

automerge
This commit is contained in:
Grimes
2020-03-05 11:52:20 -08:00
committed by GitHub
parent bda2acb06d
commit fe59ee61e6
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,