Skip to content

Commit

Permalink
[lowest-fee] Fix off by one in test
Browse files Browse the repository at this point in the history
  • Loading branch information
LLFourn committed Jan 30, 2024
1 parent 956685a commit 064996c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/lowest_fee.proptest-regressions
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ cc e30499b75a1846759fc9ffd7ee558b08a4795598cf7919f6be6d62cc7a79d4cb # shrinks to
cc c580ee452624915fc710d5fe724c7a9347472ccd178f66c9db9479cfc6168f48 # shrinks to n_candidates = 25, target_value = 488278, base_weight = 242, min_fee = 0, feerate = 6.952743, feerate_lt_diff = 0.0, drain_weight = 100, drain_spend_weight = 1, drain_dust = 100
cc 850e0115aeeb7ed50235fdb4b5183eb5bf8309a45874dc261e3d3fd2d8c84660 # shrinks to n_candidates = 8, target_value = 444541, base_weight = 253, min_fee = 0, feerate = 55.98181, feerate_lt_diff = 36.874306, drain_weight = 490, drain_spend_weight = 1779, drain_dust = 100
cc ca9831dfe4ad27fc705ae4af201b9b50739404bda0e1e130072858634f8d25d9 # added by llfourn from ci: has a case where the lowest fee metric would benefit by adding change
cc 85d9dc968a690553484d0f166f3d778c3e0ec7d9059809c2818b62d6609853c1
7 changes: 4 additions & 3 deletions tests/lowest_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ proptest! {
change_policy,
};

let (score, rounds) = common::bnb_search(&mut cs, metric, params.n_candidates)?;
println!("\t\tscore={} rounds={}", score, rounds);
prop_assert!(rounds <= params.n_candidates);
let (score, rounds) = common::bnb_search(&mut cs, metric, params.n_candidates * 10)?;
// the +1 is because the iterator will always try selecting nothing as a solution so we have
// to do one extra iteration to try that
prop_assert!(rounds <= params.n_candidates + 1, "\t\tscore={} rounds={}", score, rounds);
}

#[test]
Expand Down

0 comments on commit 064996c

Please sign in to comment.