Skip to content

Commit 384a500

Browse files
committed
f - Reuse get_cost_msat
1 parent acfc0bf commit 384a500

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lightning/src/routing/router.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,9 +1506,8 @@ where L::Target: Logger {
15061506
// prefer lower cost paths.
15071507
cur_route.sort_unstable_by(|a, b| {
15081508
a.get_value_msat().cmp(&b.get_value_msat())
1509-
// Reverse ordering for fees, so we drop higher-fee paths first
1510-
.then_with(|| b.get_total_fee_paid_msat().saturating_add(b.get_path_penalty_msat())
1511-
.cmp(&a.get_total_fee_paid_msat().saturating_add(a.get_path_penalty_msat())))
1509+
// Reverse ordering for cost, so we drop higher-cost paths first
1510+
.then_with(|| b.get_cost_msat().cmp(&a.get_cost_msat()))
15121511
});
15131512

15141513
// We should make sure that at least 1 path left.

0 commit comments

Comments
 (0)