File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -511,6 +511,10 @@ impl<'a> PaymentPath<'a> {
511
511
return result;
512
512
}
513
513
514
+ fn get_cost_msat ( & self ) -> u64 {
515
+ self . get_total_fee_paid_msat ( ) . saturating_add ( self . get_path_penalty_msat ( ) )
516
+ }
517
+
514
518
// If the amount transferred by the path is updated, the fees should be adjusted. Any other way
515
519
// to change fees may result in an inconsistency.
516
520
//
@@ -1548,8 +1552,8 @@ where L::Target: Logger {
1548
1552
}
1549
1553
1550
1554
// Step (9).
1551
- // Select the best route by lowest total fee .
1552
- drawn_routes. sort_unstable_by_key ( |paths| paths. iter ( ) . map ( |path| path. get_total_fee_paid_msat ( ) ) . sum :: < u64 > ( ) ) ;
1555
+ // Select the best route by lowest total cost .
1556
+ drawn_routes. sort_unstable_by_key ( |paths| paths. iter ( ) . map ( |path| path. get_cost_msat ( ) ) . sum :: < u64 > ( ) ) ;
1553
1557
let mut selected_paths = Vec :: < Vec < Result < RouteHop , LightningError > > > :: new ( ) ;
1554
1558
for payment_path in drawn_routes. first ( ) . unwrap ( ) {
1555
1559
let mut path = payment_path. hops . iter ( ) . map ( |( payment_hop, node_features) | {
You can’t perform that action at this time.
0 commit comments