mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
use remove_range_closed for clarity (#3088)
This commit is contained in:
parent
94b351beac
commit
39016faf52
1 changed files with 4 additions and 8 deletions
|
@ -115,10 +115,8 @@ impl LeafSet {
|
||||||
|
|
||||||
// First remove pos from leaf_set that were
|
// First remove pos from leaf_set that were
|
||||||
// added after the point we are rewinding to.
|
// added after the point we are rewinding to.
|
||||||
let marker_from = cutoff_pos;
|
let to_remove = ((cutoff_pos + 1) as u32)..bitmap.maximum();
|
||||||
let marker_to = self.bitmap.maximum() as u64;
|
bitmap.remove_range_closed(to_remove);
|
||||||
let rewind_add_pos: Bitmap = ((marker_from + 1)..=marker_to).map(|x| x as u32).collect();
|
|
||||||
bitmap.andnot_inplace(&rewind_add_pos);
|
|
||||||
|
|
||||||
// Then add back output pos to the leaf_set
|
// Then add back output pos to the leaf_set
|
||||||
// that were removed.
|
// that were removed.
|
||||||
|
@ -136,10 +134,8 @@ impl LeafSet {
|
||||||
pub fn rewind(&mut self, cutoff_pos: u64, rewind_rm_pos: &Bitmap) {
|
pub fn rewind(&mut self, cutoff_pos: u64, rewind_rm_pos: &Bitmap) {
|
||||||
// First remove pos from leaf_set that were
|
// First remove pos from leaf_set that were
|
||||||
// added after the point we are rewinding to.
|
// added after the point we are rewinding to.
|
||||||
let marker_from = cutoff_pos;
|
let to_remove = ((cutoff_pos + 1) as u32)..self.bitmap.maximum();
|
||||||
let marker_to = self.bitmap.maximum() as u64;
|
self.bitmap.remove_range_closed(to_remove);
|
||||||
let rewind_add_pos: Bitmap = ((marker_from + 1)..=marker_to).map(|x| x as u32).collect();
|
|
||||||
self.bitmap.andnot_inplace(&rewind_add_pos);
|
|
||||||
|
|
||||||
// Then add back output pos to the leaf_set
|
// Then add back output pos to the leaf_set
|
||||||
// that were removed.
|
// that were removed.
|
||||||
|
|
Loading…
Reference in a new issue