Finish routing eventualities

Also corrects some misc TODOs and tidies up some log statements.
This commit is contained in:
Luke Parker
2023-04-11 05:49:27 -04:00
parent 9e78c8fc9e
commit 90f2b03595
8 changed files with 171 additions and 50 deletions

View File

@@ -148,6 +148,21 @@ impl<E: Eventuality> EventualitiesTracker<E> {
// If our self tracker already went past this block number, set it back
self.block_number = self.block_number.min(block_number);
}
pub fn drop(&mut self, id: [u8; 32]) {
// O(n) due to the lack of a reverse lookup
let mut found_key = None;
for (key, value) in &self.map {
if value.0 == id {
found_key = Some(key.clone());
break;
}
}
if let Some(key) = found_key {
self.map.remove(&key);
}
}
}
impl<E: Eventuality> Default for EventualitiesTracker<E> {