@@ -897,7 +897,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
897
897
} ,
898
898
}
899
899
900
- // Step (1 ).
900
+ // Step (2 ).
901
901
// If a caller provided us with last hops, add them to routing targets. Since this happens
902
902
// earlier than general path finding, they will be somewhat prioritized, although currently
903
903
// it matters only if the fees are exactly the same.
@@ -995,7 +995,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
995
995
// last hops communicated by the caller, and the payment receiver.
996
996
let mut found_new_path = false ;
997
997
998
- // Step (2 ).
998
+ // Step (3 ).
999
999
// If this loop terminates due the exhaustion of targets, two situations are possible:
1000
1000
// - not enough outgoing liquidity:
1001
1001
// 0 < already_collected_value_msat < final_value_msat
@@ -1130,7 +1130,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
1130
1130
break ' paths_collection;
1131
1131
}
1132
1132
1133
- // Step (3 ).
1133
+ // Step (4 ).
1134
1134
// Stop either when the recommended value is reached or if no new path was found in this
1135
1135
// iteration.
1136
1136
// In the latter case, making another path finding attempt won't help,
@@ -1154,7 +1154,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
1154
1154
}
1155
1155
}
1156
1156
1157
- // Step (4 ).
1157
+ // Step (5 ).
1158
1158
if payment_paths. len ( ) == 0 {
1159
1159
return Err ( LightningError { err : "Failed to find a path to the given destination" . to_owned ( ) , action : ErrorAction :: IgnoreError } ) ;
1160
1160
}
@@ -1175,12 +1175,12 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
1175
1175
let mut cur_route = Vec :: < PaymentPath > :: new ( ) ;
1176
1176
let mut aggregate_route_value_msat = 0 ;
1177
1177
1178
- // Step (5 ).
1178
+ // Step (6 ).
1179
1179
// TODO: real random shuffle
1180
1180
// Currently just starts with i_th and goes up to i-1_th in a looped way.
1181
1181
let cur_payment_paths = [ & payment_paths[ i..] , & payment_paths[ ..i] ] . concat ( ) ;
1182
1182
1183
- // Step (6 ).
1183
+ // Step (7 ).
1184
1184
for payment_path in cur_payment_paths {
1185
1185
cur_route. push ( payment_path. clone ( ) ) ;
1186
1186
aggregate_route_value_msat += payment_path. get_value_msat ( ) ;
@@ -1219,7 +1219,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
1219
1219
1220
1220
assert ! ( cur_route. len( ) > 0 ) ;
1221
1221
1222
- // Step (7 ).
1222
+ // Step (8 ).
1223
1223
// Now, substract the overpaid value from the most-expensive path.
1224
1224
// TODO: this could also be optimized by also sorting by feerate_per_sat_routed,
1225
1225
// so that the sender pays less fees overall. And also htlc_minimum_msat.
@@ -1236,7 +1236,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
1236
1236
drawn_routes. push ( cur_route) ;
1237
1237
}
1238
1238
1239
- // Step (8 ).
1239
+ // Step (9 ).
1240
1240
// Select the best route by lowest total fee.
1241
1241
drawn_routes. sort_by_key ( |paths| paths. iter ( ) . map ( |path| path. get_total_fee_paid_msat ( ) ) . sum :: < u64 > ( ) ) ;
1242
1242
let mut selected_paths = Vec :: < Vec < RouteHop > > :: new ( ) ;
0 commit comments