Skip to content

Commit

Permalink
[lowest-fee] ignore failure when selection is not possible
Browse files Browse the repository at this point in the history
  • Loading branch information
LLFourn committed Jan 30, 2024
1 parent 064996c commit 8eb582b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/lowest_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,15 @@ proptest! {
long_term_feerate: params.long_term_feerate(),
change_policy,
};

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);
let is_impossible = !cs.is_selection_possible(params.target());
match common::bnb_search(&mut cs, metric, params.n_candidates * 10) {
Ok((score, rounds)) => {
// 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)
},
Err(_e) => assert!(is_impossible),
}
}

#[test]
Expand Down

0 comments on commit 8eb582b

Please sign in to comment.