@@ -515,7 +515,9 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
515515 // since that value has to be transferred over this channel.
516516 // Returns whether this channel caused an update to `targets`.
517517 ( $chan_id: expr, $src_node_id: expr, $dest_node_id: expr, $directional_info: expr, $capacity_sats: expr, $chan_features: expr, $next_hops_fee_msat: expr,
518- $next_hops_value_contribution: expr, $next_hops_path_htlc_minimum_msat: expr ) => {
518+ $next_hops_value_contribution: expr, $next_hops_path_htlc_minimum_msat: expr ) => { {
519+ // We "return" whether we updated the path at the end, via this:
520+ let mut did_add_update_path_to_src_node = false ;
519521 // Channels to self should not be used. This is more of belt-and-suspenders, because in
520522 // practice these cases should be caught earlier:
521523 // - for regular channels at channel announcement (TODO)
@@ -593,7 +595,6 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
593595 // as not sufficient.
594596 if !over_path_minimum_msat {
595597 hit_minimum_limit = true ;
596- false
597598 } else if contributes_sufficient_value {
598599 // Note that low contribution here (limited by available_liquidity_msat)
599600 // might violate htlc_minimum_msat on the hops which are next along the
@@ -728,7 +729,7 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
728729 {
729730 old_entry. value_contribution_msat = value_contribution_msat;
730731 }
731- true
732+ did_add_update_path_to_src_node = true ;
732733 } else if old_entry. was_processed && new_cost < old_cost {
733734 #[ cfg( any( test, feature = "fuzztarget" ) ) ]
734735 {
@@ -754,13 +755,13 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
754755 debug_assert!( path_htlc_minimum_msat < old_entry. path_htlc_minimum_msat) ;
755756 debug_assert!( value_contribution_msat < old_entry. value_contribution_msat) ;
756757 }
757- false
758- } else { false }
759- } else { false }
760- } else { false }
761- } else { false }
762- } else { false }
763- } ;
758+ }
759+ }
760+ }
761+ }
762+ }
763+ did_add_update_path_to_src_node
764+ } }
764765 }
765766
766767 let empty_node_features = NodeFeatures :: empty ( ) ;
0 commit comments