@@ -1164,6 +1164,7 @@ impl_writeable_tlv_based!(RouteHintHop, {
1164
1164
#[ repr( align( 64 ) ) ] // Force the size to 64 bytes
1165
1165
struct RouteGraphNode {
1166
1166
node_id : NodeId ,
1167
+ node_counter : u32 ,
1167
1168
score : u64 ,
1168
1169
// The maximum value a yet-to-be-constructed payment path might flow through this node.
1169
1170
// This value is upper-bounded by us by:
@@ -1178,7 +1179,7 @@ struct RouteGraphNode {
1178
1179
1179
1180
impl cmp:: Ord for RouteGraphNode {
1180
1181
fn cmp ( & self , other : & RouteGraphNode ) -> cmp:: Ordering {
1181
- other. score . cmp ( & self . score ) . then_with ( || other. node_id . cmp ( & self . node_id ) )
1182
+ other. score . cmp ( & self . score ) . then_with ( || other. node_counter . cmp ( & self . node_counter ) )
1182
1183
}
1183
1184
}
1184
1185
@@ -2625,6 +2626,7 @@ where L::Target: Logger {
2625
2626
if !old_entry. was_processed && new_cost < old_cost {
2626
2627
let new_graph_node = RouteGraphNode {
2627
2628
node_id: src_node_id,
2629
+ node_counter: src_node_counter,
2628
2630
score: cmp:: max( total_fee_msat, path_htlc_minimum_msat) . saturating_add( path_penalty_msat) ,
2629
2631
total_cltv_delta: hop_total_cltv_delta,
2630
2632
value_contribution_msat,
@@ -2703,7 +2705,7 @@ where L::Target: Logger {
2703
2705
// meaning how much will be paid in fees after this node (to the best of our knowledge).
2704
2706
// This data can later be helpful to optimize routing (pay lower fees).
2705
2707
macro_rules! add_entries_to_cheapest_to_target_node {
2706
- ( $node: expr, $node_id: expr, $next_hops_value_contribution: expr,
2708
+ ( $node: expr, $node_counter : expr , $ node_id: expr, $next_hops_value_contribution: expr,
2707
2709
$next_hops_cltv_delta: expr, $next_hops_path_length: expr ) => {
2708
2710
let fee_to_target_msat;
2709
2711
let next_hops_path_htlc_minimum_msat;
@@ -2843,7 +2845,9 @@ where L::Target: Logger {
2843
2845
// If not, targets.pop() will not even let us enter the loop in step 2.
2844
2846
None => { } ,
2845
2847
Some ( node) => {
2846
- add_entries_to_cheapest_to_target_node ! ( node, payee, path_value_msat, 0 , 0 ) ;
2848
+ add_entries_to_cheapest_to_target_node ! (
2849
+ node, node. node_counter, payee, path_value_msat, 0 , 0
2850
+ ) ;
2847
2851
} ,
2848
2852
} ) ;
2849
2853
@@ -3071,7 +3075,7 @@ where L::Target: Logger {
3071
3075
// Both these cases (and other cases except reaching recommended_value_msat) mean that
3072
3076
// paths_collection will be stopped because found_new_path==false.
3073
3077
// This is not necessarily a routing failure.
3074
- ' path_construction: while let Some ( RouteGraphNode { node_id, total_cltv_delta, mut value_contribution_msat, path_length_to_node, .. } ) = targets. pop ( ) {
3078
+ ' path_construction: while let Some ( RouteGraphNode { node_id, node_counter , total_cltv_delta, mut value_contribution_msat, path_length_to_node, .. } ) = targets. pop ( ) {
3075
3079
3076
3080
// Since we're going payee-to-payer, hitting our node as a target means we should stop
3077
3081
// traversing the graph and arrange the path out of what we found.
@@ -3209,7 +3213,8 @@ where L::Target: Logger {
3209
3213
match network_nodes. get ( & node_id) {
3210
3214
None => { } ,
3211
3215
Some ( node) => {
3212
- add_entries_to_cheapest_to_target_node ! ( node, node_id,
3216
+ add_entries_to_cheapest_to_target_node ! (
3217
+ node, node_counter, node_id,
3213
3218
value_contribution_msat,
3214
3219
total_cltv_delta, path_length_to_node) ;
3215
3220
} ,
0 commit comments