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});
2002
-
}
2003
-
}
2004
-
}
2005
-
},
2006
-
Payee::Blinded{ route_hints, .. } => {
2007
-
if introduction_node_id_cache.iter().all(|introduction_node_id| *introduction_node_id == Some(&our_node_id)){
2008
-
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});
2022
-
}
2023
-
}
2024
-
}
2025
-
}
2026
1993
let final_cltv_expiry_delta = payment_params.payee.final_cltv_expiry_delta().unwrap_or(0);
2027
1994
if payment_params.max_total_cltv_expiry_delta <= final_cltv_expiry_delta {
2028
1995
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});
@@ -2139,10 +2106,10 @@ where L::Target: Logger {
2139
2106
}
2140
2107
}
2141
2108
2142
-
// Step (1).
2143
-
// Prepare the data we'll use for payee-to-payer search by
2144
-
// inserting first hops suggested by the caller as targets.
2145
-
// Our search will then attempt to reach them while traversing from the payee node.
2109
+
// Step (1). Prep first and last hop targets.
2110
+
//
2111
+
// First cache all our direct channels so that we can insert them in the heap at startup.
2112
+
// Then process any blinded routes, resolving their introduction node and caching it.
returnErr(LightningError{err:"Route hint cannot have the payee as the source.".to_owned(),action:ErrorAction::IgnoreError});
2170
+
}
2171
+
}
2172
+
}
2173
+
},
2174
+
Payee::Blinded{ route_hints, .. } => {
2175
+
if introduction_node_id_cache.iter().all(|info_opt| info_opt.map(|(a, _)| a) == Some(&our_node_id)){
2176
+
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