Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add excess to changeless LowestFee score #11

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/metrics/lowest_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ where
fn calc_metric(&self, cs: &CoinSelector<'_>, drain_weights: Option<DrainWeights>) -> f32 {
self.calc_metric_lb(cs, drain_weights)
+ match drain_weights {
Some(_) => {
Some(_) => 0.0,
None => {
let selected_value = cs.selected_value();
assert!(selected_value >= self.target.value);
(cs.selected_value() - self.target.value) as f32
}
None => 0.0,
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/lowest_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ fn combined_changeless_metric() {
common::bnb_search(&mut cs_b, metric_combined, usize::MAX).expect("must find solution");
println!("score={:?} rounds={}", combined_score, combined_rounds);

// [todo] shouldn't rounds be less since we are only considering changeless branches?
assert!(combined_rounds <= rounds);
// rounds is less since combined only considers changeless branches
assert!(rounds <= combined_rounds);
}