Skip to content

Commit

Permalink
test: fixup test_update_descendants
Browse files Browse the repository at this point in the history
  • Loading branch information
ValuedMammal committed Feb 19, 2025
1 parent 60bce0e commit c9b1f0f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/blockmk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,29 +730,30 @@ mod test {
let ancestor_id = 0usize;
let effective_feerate = 5.0;
maker.update_descendants(0, effective_feerate);
let child = maker.pool.get(&1).unwrap();
let parent = maker.pool.get(&1).unwrap();
assert!(!parent.ancestors.contains(&ancestor_id));
let child = maker.pool.get(&2).unwrap();
assert!(!child.ancestors.contains(&ancestor_id));
let grandchild = maker.pool.get(&2).unwrap();
assert!(!grandchild.ancestors.contains(&ancestor_id));

// Score changed
// if a (comparatively) lo-fee ancestor is now in block,
// expect descendant score increase.
// likewise, if hi-fee ancestor is in block,
// expect descendant score decrease.
let old_score = 7000.0 / (2400.0 / 4.0);
let score = 600.0 / (1600.0 / 4.0);
assert!(grandchild.score > old_score);
let score = 6000.0 / (1600.0 / 4.0);
assert!(child.score > old_score);
let expect = TxPriority {
uid: 2,
order: 2,
score,
};

// Modified queue has two entries and
// grandchild is front of queue
// child is front of queue
assert_eq!(maker.modified.len(), 2);
let (_uid, priority) = maker.modified.pop().unwrap();
let (uid, priority) = maker.modified.pop().unwrap();
assert_eq!(uid, child.uid);
assert_eq!(priority, expect);
}
}

0 comments on commit c9b1f0f

Please sign in to comment.