X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fblinded_path%2Fmod.rs;h=5d199269520e16c9c79464a01a86a2d55b098d8b;hb=63ebaccca3c284c28f24537c2c0c034f9cc9c3c4;hp=e70f310f5e1d8b00875ff58e069f432bd69526cf;hpb=b783736356d17704852ea121a325b2978884ad9a;p=rust-lightning diff --git a/lightning/src/blinded_path/mod.rs b/lightning/src/blinded_path/mod.rs index e70f310f..5d199269 100644 --- a/lightning/src/blinded_path/mod.rs +++ b/lightning/src/blinded_path/mod.rs @@ -17,6 +17,7 @@ use bitcoin::secp256k1::{self, PublicKey, Secp256k1, SecretKey}; use crate::ln::msgs::DecodeError; use crate::offers::invoice::BlindedPayInfo; +use crate::routing::gossip::{NodeId, ReadOnlyNetworkGraph}; use crate::sign::EntropySource; use crate::util::ser::{Readable, Writeable, Writer}; @@ -125,6 +126,14 @@ impl BlindedPath { ).map_err(|_| ())?, })) } + + /// Returns the introduction [`NodeId`] of the blinded path. + pub fn public_introduction_node_id<'a>( + &self, network_graph: &'a ReadOnlyNetworkGraph + ) -> Option<&'a NodeId> { + let node_id = NodeId::from_pubkey(&self.introduction_node_id); + network_graph.nodes().get_key_value(&node_id).map(|(key, _)| key) + } } impl Writeable for BlindedPath {