Fix race with LedgerCleanupService (#5622)
This commit is contained in:
parent
4e827af392
commit
6e82978931
|
@ -29,16 +29,23 @@ impl<'a> Iterator for RootedSlotIterator<'a> {
|
||||||
.find(|x| self.blocktree.is_root(**x))
|
.find(|x| self.blocktree.is_root(**x))
|
||||||
.cloned();
|
.cloned();
|
||||||
|
|
||||||
rooted_slot.map(|rooted_slot| {
|
rooted_slot
|
||||||
|
.map(|rooted_slot| {
|
||||||
let slot_meta = self
|
let slot_meta = self
|
||||||
.blocktree
|
.blocktree
|
||||||
.meta(rooted_slot)
|
.meta(rooted_slot)
|
||||||
.expect("Database failure, couldnt fetch SlotMeta")
|
.expect("Database failure, couldnt fetch SlotMeta");
|
||||||
.expect("SlotMeta in iterator didn't exist");
|
|
||||||
|
|
||||||
|
if slot_meta.is_none() {
|
||||||
|
warn!("Rooted SlotMeta was deleted in between checking is_root and fetch");
|
||||||
|
}
|
||||||
|
|
||||||
|
slot_meta.map(|slot_meta| {
|
||||||
self.next_slots = slot_meta.next_slots.clone();
|
self.next_slots = slot_meta.next_slots.clone();
|
||||||
(rooted_slot, slot_meta)
|
(rooted_slot, slot_meta)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
.unwrap_or(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue