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