Split header MMR (and sync MMR) out from txhashset (#3004)
* wip * sync sort of works now * get rid of the deadlock during compaction there is *always* a deadlock in there when we make changes like this... * cleanup how we rebuild the sync MMR on init * cleanup rewind logic * roll the "fix invalid root" changes into this PR * move rebuild_height_pos_index into txhashset and pass in header_pmmr for header lookups * cleanup and remember to setup sync head on init * cleanup unnecessary ref muts * rebuild_height_pos_index when writing txhashset
This commit is contained in:
committed by
Gary Yu
parent
d55ebe8a2b
commit
383985292c
@@ -216,13 +216,6 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Truncate the MMR by rewinding back to empty state.
|
||||
pub fn truncate(&mut self) -> Result<(), String> {
|
||||
self.backend.rewind(0, &Bitmap::create())?;
|
||||
self.last_pos = 0;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Rewind the PMMR to a previous position, as if all push operations after
|
||||
/// that had been canceled. Expects a position in the PMMR to rewind and
|
||||
/// bitmaps representing the positions added and removed that we want to
|
||||
|
||||
@@ -86,6 +86,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterator over current (unpruned, unremoved) leaf positions.
|
||||
pub fn leaf_pos_iter(&self) -> impl Iterator<Item = u64> + '_ {
|
||||
self.backend.leaf_pos_iter()
|
||||
}
|
||||
|
||||
/// Is the MMR empty?
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.last_pos == 0
|
||||
|
||||
Reference in New Issue
Block a user