Merge pull request #59 from nuttycom/fix_premature_tracking

Do not eagerly track marked nodes in the current bridge.
This commit is contained in:
Kris Nuttycombe 2023-03-24 08:29:38 -06:00 committed by GitHub
commit 0d1c3e6512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -980,7 +980,6 @@ impl<H: Hashable + Ord + Clone, const DEPTH: u8> BridgeTree<H, DEPTH> {
pub fn mark(&mut self) -> Option<Position> {
match self.current_bridge.take() {
Some(mut cur_b) => {
cur_b.track_current_leaf();
let pos = cur_b.position();
// If the latest bridge is a newly created checkpoint, the last prior
// bridge will have the same position and all we need to do is mark
@ -992,8 +991,10 @@ impl<H: Hashable + Ord + Clone, const DEPTH: u8> BridgeTree<H, DEPTH> {
{
// the current bridge has not been advanced, so we just need to make
// sure that we have are tracking the marked leaf
cur_b.track_current_leaf();
self.current_bridge = Some(cur_b);
} else {
// the successor(true) call will ensure that the marked leaf is tracked
let successor = cur_b.successor(true);
self.prior_bridges.push(cur_b);
self.current_bridge = Some(successor);