Skip to content

Commit 8eb582b

Browse files
committed
[lowest-fee] ignore failure when selection is not possible
1 parent 064996c commit 8eb582b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/lowest_fee.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,15 @@ proptest! {
9898
long_term_feerate: params.long_term_feerate(),
9999
change_policy,
100100
};
101-
102-
let (score, rounds) = common::bnb_search(&mut cs, metric, params.n_candidates * 10)?;
103-
// the +1 is because the iterator will always try selecting nothing as a solution so we have
104-
// to do one extra iteration to try that
105-
prop_assert!(rounds <= params.n_candidates + 1, "\t\tscore={} rounds={}", score, rounds);
101+
let is_impossible = !cs.is_selection_possible(params.target());
102+
match common::bnb_search(&mut cs, metric, params.n_candidates * 10) {
103+
Ok((score, rounds)) => {
104+
// the +1 is because the iterator will always try selecting nothing as a solution so we have
105+
// to do one extra iteration to try that
106+
prop_assert!(rounds <= params.n_candidates + 1, "\t\tscore={} rounds={}", score, rounds)
107+
},
108+
Err(_e) => assert!(is_impossible),
109+
}
106110
}
107111

108112
#[test]

0 commit comments

Comments
 (0)