@@ -751,9 +751,9 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
751
751
macro_rules! add_entries_to_cheapest_to_target_node {
752
752
( $node: expr, $node_id: expr, $fee_to_target_msat: expr, $next_hops_value_contribution: expr, $next_hops_path_htlc_minimum_msat: expr ) => {
753
753
let skip_node = if let Some ( elem) = dist. get_mut( $node_id) {
754
- let v = elem. was_processed;
754
+ let was_processed = elem. was_processed;
755
755
elem. was_processed = true ;
756
- v
756
+ was_processed
757
757
} else {
758
758
// Entries are added to dist in add_entry!() when there is a channel from a node.
759
759
// Because there are no channels from payee, it will not have a dist entry at this point.
@@ -762,40 +762,41 @@ pub fn get_route<L: Deref>(our_node_id: &PublicKey, network: &NetworkGraph, paye
762
762
false
763
763
} ;
764
764
765
- if !skip_node && first_hops. is_some( ) {
766
- if let Some ( & ( ref first_hop, ref features, ref outbound_capacity_msat) ) = first_hop_targets. get( & $node_id) {
767
- add_entry!( first_hop, * our_node_id, $node_id, dummy_directional_info, Some ( outbound_capacity_msat / 1000 ) , features. to_context( ) , $fee_to_target_msat, $next_hops_value_contribution, $next_hops_path_htlc_minimum_msat) ;
765
+ if !skip_node {
766
+ if first_hops. is_some( ) {
767
+ if let Some ( & ( ref first_hop, ref features, ref outbound_capacity_msat) ) = first_hop_targets. get( & $node_id) {
768
+ add_entry!( first_hop, * our_node_id, $node_id, dummy_directional_info, Some ( outbound_capacity_msat / 1000 ) , features. to_context( ) , $fee_to_target_msat, $next_hops_value_contribution, $next_hops_path_htlc_minimum_msat) ;
769
+ }
768
770
}
769
- }
770
771
771
- let features;
772
- if let Some ( node_info) = $node. announcement_info. as_ref( ) {
773
- features = node_info. features. clone( ) ;
774
- } else {
775
- features = NodeFeatures :: empty( ) ;
776
- }
772
+ let features;
773
+ if let Some ( node_info) = $node. announcement_info. as_ref( ) {
774
+ features = node_info. features. clone( ) ;
775
+ } else {
776
+ features = NodeFeatures :: empty( ) ;
777
+ }
777
778
778
- if !skip_node && !features. requires_unknown_bits( ) {
779
- for chan_id in $node. channels. iter( ) {
780
- let chan = network. get_channels( ) . get( chan_id) . unwrap( ) ;
781
- if !chan. features. requires_unknown_bits( ) {
782
- if chan. node_one == * $node_id {
783
- // ie $node is one, ie next hop in A* is two, via the two_to_one channel
784
- if first_hops. is_none( ) || chan. node_two != * our_node_id {
785
- if let Some ( two_to_one) = chan. two_to_one. as_ref( ) {
786
- if two_to_one. enabled {
787
- add_entry!( chan_id, chan. node_two, chan. node_one, two_to_one, chan. capacity_sats, chan. features, $fee_to_target_msat, $next_hops_value_contribution, $next_hops_path_htlc_minimum_msat) ;
779
+ if !features. requires_unknown_bits( ) {
780
+ for chan_id in $node. channels. iter( ) {
781
+ let chan = network. get_channels( ) . get( chan_id) . unwrap( ) ;
782
+ if !chan. features. requires_unknown_bits( ) {
783
+ if chan. node_one == * $node_id {
784
+ // ie $node is one, ie next hop in A* is two, via the two_to_one channel
785
+ if first_hops. is_none( ) || chan. node_two != * our_node_id {
786
+ if let Some ( two_to_one) = chan. two_to_one. as_ref( ) {
787
+ if two_to_one. enabled {
788
+ add_entry!( chan_id, chan. node_two, chan. node_one, two_to_one, chan. capacity_sats, chan. features, $fee_to_target_msat, $next_hops_value_contribution, $next_hops_path_htlc_minimum_msat) ;
789
+ }
788
790
}
789
791
}
790
- }
791
- } else {
792
- if first_hops . is_none ( ) || chan. node_one != * our_node_id {
793
- if let Some ( one_to_two) = chan . one_to_two . as_ref ( ) {
794
- if one_to_two. enabled {
795
- add_entry! ( chan_id , chan . node_one , chan . node_two , one_to_two , chan . capacity_sats , chan . features , $fee_to_target_msat , $next_hops_value_contribution , $next_hops_path_htlc_minimum_msat ) ;
792
+ } else {
793
+ if first_hops . is_none ( ) || chan . node_one != * our_node_id {
794
+ if let Some ( one_to_two ) = chan. one_to_two . as_ref ( ) {
795
+ if one_to_two. enabled {
796
+ add_entry! ( chan_id , chan . node_one , chan . node_two , one_to_two, chan . capacity_sats , chan . features , $fee_to_target_msat , $next_hops_value_contribution , $next_hops_path_htlc_minimum_msat ) ;
797
+ }
796
798
}
797
799
}
798
-
799
800
}
800
801
}
801
802
}
0 commit comments