@@ -248,14 +248,12 @@ impl<'a> PaymentPath<'a> {
248
248
// If the amount transferred by the path is updated, the fees should be adjusted. Any other way
249
249
// to change fees may result in an inconsistency.
250
250
//
251
- // Sometimes we call this function right after constructing a path which has inconsistent
252
- // (in terms of reaching htlc_minimum_msat), so that this function puts the fees in order.
253
- // In that case we call it on the "same" amount we initially allocated for this path, and which
254
- // could have been reduced on the way. In that case, there is also a risk of exceeding
255
- // available_liquidity inside this function, because the function is unaware of this bound.
256
- // In our specific recomputation cases where we never increase the value the risk is pretty low.
257
- // This function, however, does not support arbitrarily increasing the value being transferred,
258
- // and the exception will be triggered.
251
+ // Sometimes we call this function right after constructing a path which is inconsistent in
252
+ // that it the value being transferred has decreased while we were doing path finding, leading
253
+ // to the fees being paid not linig up with the actual limits.
254
+ //
255
+ // Note that this function is not aware of the available_liquidity limit, and thus does not
256
+ // support increasing the value being transferred.
259
257
fn update_value_and_recompute_fees ( & mut self , value_msat : u64 ) {
260
258
assert ! ( value_msat <= self . hops. last( ) . unwrap( ) . 0 . fee_msat) ;
261
259
@@ -476,7 +474,13 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
476
474
477
475
let empty_channel_features = ChannelFeatures :: empty ( ) ;
478
476
479
- let mut targets = BinaryHeap :: new ( ) ; //TODO: Do we care about switching to eg Fibbonaci heap?
477
+ // The main heap containing all candidate next-hops sorted by their score (max(A* fee,
478
+ // htlc_minimum)). Ideally this would be a heap which allowed cheap score reduction instead of
479
+ // adding duplicate entries when we find a better path to a given node.
480
+ let mut targets = BinaryHeap :: new ( ) ;
481
+
482
+ // Map from node_id to information about the best current path to that node, including feerate
483
+ // information.
480
484
let mut dist = HashMap :: with_capacity ( network. get_nodes ( ) . len ( ) ) ;
481
485
482
486
// During routing, if we ignore a path due to an htlc_minimum_msat limit, we set this,
0 commit comments