You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use NodeCountersNodeIds as the blinded path intro references
The router's `introduction_node_id_cache` is used to cache the
`NodeId`s of blinded path introduction points so that we don't
have to look them up every time we go around the main router loop.
When using it, if the introduction point isn't a public node we
then look up the introduction in our first-hops map.
In either case, we have to end up with a reference to a `NodeId`
that outlives our `dist` map.
Here we consolidate both the initial cache building and the
first-hops map lookup to one place, storing only a reference to a
`NodeId` either in the `NetworkGraph` or in the new `NodeCounters`
to get the required lifetime without needing to reference into the
first-hops map.
We then take this opportunity to avoid `clone`ing the first-hops
map entries as we now no longer reference into it.
returnErr(LightningError{err:"Route hint cannot have the payee as the source.".to_owned(),action:ErrorAction::IgnoreError});
1989
-
}
1990
-
}
1991
-
}
1992
-
},
1993
-
Payee::Blinded{ route_hints, .. } => {
1994
-
if introduction_node_id_cache.iter().all(|introduction_node_id| *introduction_node_id == Some(&our_node_id)){
1995
-
returnErr(LightningError{err:"Cannot generate a route to blinded paths if we are the introduction node to all of them".to_owned(),action:ErrorAction::IgnoreError});
returnErr(LightningError{err:format!("1-hop blinded paths must all have matching introduction node ids"),action:ErrorAction::IgnoreError});
2009
-
}
2010
-
}
2011
-
}
2012
-
}
2013
1980
let final_cltv_expiry_delta = payment_params.payee.final_cltv_expiry_delta().unwrap_or(0);
2014
1981
if payment_params.max_total_cltv_expiry_delta <= final_cltv_expiry_delta {
2015
1982
returnErr(LightningError{err:"Can't find a route where the maximum total CLTV expiry delta is below the final CLTV expiry.".to_owned(),action:ErrorAction::IgnoreError});
@@ -2157,6 +2124,64 @@ where L::Target: Logger {
2157
2124
2158
2125
let node_counters = node_counters.build();
2159
2126
2127
+
let introduction_node_id_cache = payment_params.payee.blinded_route_hints().iter()
returnErr(LightningError{err:"Route hint cannot have the payee as the source.".to_owned(),action:ErrorAction::IgnoreError});
2157
+
}
2158
+
}
2159
+
}
2160
+
},
2161
+
Payee::Blinded{ route_hints, .. } => {
2162
+
if introduction_node_id_cache.iter().all(|info_opt| info_opt.map(|(a, _)| a) == Some(&our_node_id)){
2163
+
returnErr(LightningError{err:"Cannot generate a route to blinded paths if we are the introduction node to all of them".to_owned(),action:ErrorAction::IgnoreError});
0 commit comments