From c563c150f0c7adc59ca3f783cde5cb0e8e88d40d Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Tue, 13 Aug 2024 14:28:02 -0400 Subject: [PATCH] Add accessor methods for inner blinded path fields. --- lightning/src/blinded_path/message.rs | 17 +++++++++++++++++ lightning/src/blinded_path/payment.rs | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/lightning/src/blinded_path/message.rs b/lightning/src/blinded_path/message.rs index b2199d514..d5c44fbd5 100644 --- a/lightning/src/blinded_path/message.rs +++ b/lightning/src/blinded_path/message.rs @@ -120,6 +120,23 @@ impl BlindedMessagePath { ) -> Option<&'a NodeId> { self.0.public_introduction_node_id(network_graph) } + + /// The [`IntroductionNode`] of the blinded path. + pub fn introduction_node(&self) -> &IntroductionNode { + &self.0.introduction_node + } + + /// Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the message. + /// + /// [`encrypted_payload`]: BlindedHop::encrypted_payload + pub fn blinding_point(&self) -> PublicKey { + self.0.blinding_point + } + + /// The [`BlindedHop`]s within the blinded path. + pub fn blinded_hops(&self) -> &[BlindedHop] { + &self.0.blinded_hops + } } /// An intermediate node, and possibly a short channel id leading to the next node. diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs index 0d40ecf61..ad8e9b5bd 100644 --- a/lightning/src/blinded_path/payment.rs +++ b/lightning/src/blinded_path/payment.rs @@ -103,6 +103,23 @@ impl BlindedPaymentPath { ) -> Option<&'a NodeId> { self.0.public_introduction_node_id(network_graph) } + + /// The [`IntroductionNode`] of the blinded path. + pub fn introduction_node(&self) -> &IntroductionNode { + &self.0.introduction_node + } + + /// Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the payment. + /// + /// [`encrypted_payload`]: BlindedHop::encrypted_payload + pub fn blinding_point(&self) -> PublicKey { + self.0.blinding_point + } + + /// The [`BlindedHop`]s within the blinded path. + pub fn blinded_hops(&self) -> &[BlindedHop] { + &self.0.blinded_hops + } } /// An intermediate node, its outbound channel, and relay parameters. -- 2.39.5