Helps move towards making the BlindedPath struct private.
}
}
}
+
+ /// Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e.,
+ /// it is found in the network graph).
+ pub fn public_introduction_node_id<'a>(
+ &self, network_graph: &'a ReadOnlyNetworkGraph
+ ) -> Option<&'a NodeId> {
+ self.0.public_introduction_node_id(network_graph)
+ }
}
/// An intermediate node, and possibly a short channel id leading to the next node.
}
impl BlindedPath {
- /// Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e.,
- /// it is found in the network graph).
- pub fn public_introduction_node_id<'a>(
+ pub(super) fn public_introduction_node_id<'a>(
&self, network_graph: &'a ReadOnlyNetworkGraph
) -> Option<&'a NodeId> {
match &self.introduction_node {
use crate::offers::invoice::BlindedPayInfo;
use crate::offers::invoice_request::InvoiceRequestFields;
use crate::offers::offer::OfferId;
+use crate::routing::gossip::{NodeId, ReadOnlyNetworkGraph};
use crate::sign::{EntropySource, NodeSigner, Recipient};
use crate::util::ser::{FixedLengthReader, LengthReadableArgs, HighZeroBytesDroppedBigSize, Readable, Writeable, Writer};
).map_err(|_| ())?,
})))
}
+
+ /// Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e.,
+ /// it is found in the network graph).
+ pub fn public_introduction_node_id<'a>(
+ &self, network_graph: &'a ReadOnlyNetworkGraph
+ ) -> Option<&'a NodeId> {
+ self.0.public_introduction_node_id(network_graph)
+ }
}
/// An intermediate node, its outbound channel, and relay parameters.
}
fn resolve_introduction_node<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, path: &BlindedMessagePath) -> PublicKey {
- path.0.public_introduction_node_id(&node.network_graph.read_only())
+ path.public_introduction_node_id(&node.network_graph.read_only())
.and_then(|node_id| node_id.as_pubkey().ok())
.unwrap()
}
if let Destination::BlindedPath(path) = self {
if let IntroductionNode::DirectedShortChannelId(..) = path.0.introduction_node {
if let Some(pubkey) = path
- .0
.public_introduction_node_id(network_graph)
.and_then(|node_id| node_id.as_pubkey().ok())
{
node_counters.node_counter_from_id(&NodeId::from_pubkey(&pubkey))
},
IntroductionNode::DirectedShortChannelId(direction, scid) => {
- path.0.public_introduction_node_id(network_graph)
+ path.public_introduction_node_id(network_graph)
.map(|node_id_ref| *node_id_ref)
.or_else(|| {
first_hop_targets.iter().find(|(_, (channels, _))|
NodeId::from_pubkey(&path.hops.last().unwrap().pubkey),
payment_params.payee.blinded_route_hints().iter()
.find(|(p, _)| p.htlc_maximum_msat == path.final_value_msat())
- .and_then(|(_, p)| p.0.public_introduction_node_id(&network_graph))
+ .and_then(|(_, p)| p.public_introduction_node_id(&network_graph))
.copied()
.unwrap()
);
let final_hop = route.paths[0].hops.last().unwrap();
assert_eq!(
NodeId::from_pubkey(&final_hop.pubkey),
- *blinded_path.0.public_introduction_node_id(&network_graph).unwrap()
+ *blinded_path.public_introduction_node_id(&network_graph).unwrap()
);
if tail.hops.len() > 1 {
assert_eq!(final_hop.fee_msat,