@@ -20,7 +20,7 @@ use crate::ln::features::{InitFeatures, NodeFeatures};
2020use crate :: ln:: msgs:: { self , OnionMessageHandler } ;
2121use crate :: ln:: onion_utils;
2222use crate :: ln:: peer_handler:: IgnoringMessageHandler ;
23- use super :: blinded_route:: { BlindedRoute , ForwardTlvs , ReceiveTlvs } ;
23+ use super :: blinded_route:: { BlindedPath , ForwardTlvs , ReceiveTlvs } ;
2424pub use super :: packet:: { CustomOnionMessageContents , OnionMessageContents } ;
2525use super :: packet:: { BIG_PACKET_HOP_DATA_LEN , ForwardControlTlvs , Packet , Payload , ReceiveControlTlvs , SMALL_PACKET_HOP_DATA_LEN } ;
2626use super :: utils;
@@ -46,7 +46,7 @@ use crate::prelude::*;
4646/// # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface};
4747/// # use lightning::ln::msgs::DecodeError;
4848/// # use lightning::ln::peer_handler::IgnoringMessageHandler;
49- /// # use lightning::onion_message::{BlindedRoute , CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger};
49+ /// # use lightning::onion_message::{BlindedPath , CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger};
5050/// # use lightning::util::logger::{Logger, Record};
5151/// # use lightning::util::ser::{Writeable, Writer};
5252/// # use lightning::io;
@@ -92,14 +92,14 @@ use crate::prelude::*;
9292/// // Create a blinded route to yourself, for someone to send an onion message to.
9393/// # let your_node_id = hop_node_id1;
9494/// let hops = [hop_node_id3, hop_node_id4, your_node_id];
95- /// let blinded_route = BlindedRoute ::new(&hops, &keys_manager, &secp_ctx).unwrap();
95+ /// let blinded_route = BlindedPath ::new(&hops, &keys_manager, &secp_ctx).unwrap();
9696///
9797/// // Send a custom onion message to a blinded route.
9898/// # let intermediate_hops = [hop_node_id1, hop_node_id2];
9999/// let reply_path = None;
100100/// # let your_custom_message = YourCustomMessage {};
101101/// let message = OnionMessageContents::Custom(your_custom_message);
102- /// onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute (blinded_route), message, reply_path);
102+ /// onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedPath (blinded_route), message, reply_path);
103103/// ```
104104///
105105/// [offers]: <https://github.com/lightning/bolts/pull/798>
@@ -123,14 +123,14 @@ pub enum Destination {
123123 /// We're sending this onion message to a node.
124124 Node ( PublicKey ) ,
125125 /// We're sending this onion message to a blinded route.
126- BlindedRoute ( BlindedRoute ) ,
126+ BlindedPath ( BlindedPath ) ,
127127}
128128
129129impl Destination {
130130 pub ( super ) fn num_hops ( & self ) -> usize {
131131 match self {
132132 Destination :: Node ( _) => 1 ,
133- Destination :: BlindedRoute ( BlindedRoute { blinded_hops, .. } ) => blinded_hops. len ( ) ,
133+ Destination :: BlindedPath ( BlindedPath { blinded_hops, .. } ) => blinded_hops. len ( ) ,
134134 }
135135 }
136136}
@@ -145,7 +145,7 @@ pub enum SendError {
145145 /// Because implementations such as Eclair will drop onion messages where the message packet
146146 /// exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size.
147147 TooBigPacket ,
148- /// The provided [`Destination`] was an invalid [`BlindedRoute `], due to having fewer than two
148+ /// The provided [`Destination`] was an invalid [`BlindedPath `], due to having fewer than two
149149 /// blinded hops.
150150 TooFewBlindedHops ,
151151 /// Our next-hop peer was offline or does not support onion message forwarding.
@@ -162,7 +162,7 @@ pub enum SendError {
162162 /// advance the blinded route to make the second hop the new introduction node. Either
163163 /// [`KeysInterface::ecdh`] failed, we failed to tweak the current blinding point to get the
164164 /// new blinding point, or we were attempting to send to ourselves.
165- BlindedRouteAdvanceFailed ,
165+ BlindedPathAdvanceFailed ,
166166}
167167
168168/// Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`],
@@ -207,8 +207,8 @@ impl<K: Deref, L: Deref, CMH: Deref> OnionMessenger<K, L, CMH>
207207
208208 /// Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
209209 /// See [`OnionMessenger`] for example usage.
210- pub fn send_onion_message < T : CustomOnionMessageContents > ( & self , intermediate_nodes : & [ PublicKey ] , mut destination : Destination , message : OnionMessageContents < T > , reply_path : Option < BlindedRoute > ) -> Result < ( ) , SendError > {
211- if let Destination :: BlindedRoute ( BlindedRoute { ref blinded_hops, .. } ) = destination {
210+ pub fn send_onion_message < T : CustomOnionMessageContents > ( & self , intermediate_nodes : & [ PublicKey ] , mut destination : Destination , message : OnionMessageContents < T > , reply_path : Option < BlindedPath > ) -> Result < ( ) , SendError > {
211+ if let Destination :: BlindedPath ( BlindedPath { ref blinded_hops, .. } ) = destination {
212212 if blinded_hops. len ( ) < 2 {
213213 return Err ( SendError :: TooFewBlindedHops ) ;
214214 }
@@ -219,12 +219,12 @@ impl<K: Deref, L: Deref, CMH: Deref> OnionMessenger<K, L, CMH>
219219 // If we are sending straight to a blinded route and we are the introduction node, we need to
220220 // advance the blinded route by 1 hop so the second hop is the new introduction node.
221221 if intermediate_nodes. len ( ) == 0 {
222- if let Destination :: BlindedRoute ( ref mut blinded_route) = destination {
222+ if let Destination :: BlindedPath ( ref mut blinded_route) = destination {
223223 let our_node_id = self . keys_manager . get_node_id ( Recipient :: Node )
224224 . map_err ( |( ) | SendError :: GetNodeIdFailed ) ?;
225225 if blinded_route. introduction_node_id == our_node_id {
226226 blinded_route. advance_by_one ( & self . keys_manager , & self . secp_ctx )
227- . map_err ( |( ) | SendError :: BlindedRouteAdvanceFailed ) ?;
227+ . map_err ( |( ) | SendError :: BlindedPathAdvanceFailed ) ?;
228228 }
229229 }
230230 }
@@ -236,7 +236,7 @@ impl<K: Deref, L: Deref, CMH: Deref> OnionMessenger<K, L, CMH>
236236 } else {
237237 match destination {
238238 Destination :: Node ( pk) => ( pk, PublicKey :: from_secret_key ( & self . secp_ctx , & blinding_secret) ) ,
239- Destination :: BlindedRoute ( BlindedRoute { introduction_node_id, blinding_point, .. } ) =>
239+ Destination :: BlindedPath ( BlindedPath { introduction_node_id, blinding_point, .. } ) =>
240240 ( introduction_node_id, blinding_point) ,
241241 }
242242 } ;
@@ -476,13 +476,13 @@ pub type SimpleRefOnionMessenger<'a, 'b, L> = OnionMessenger<&'a KeysManager, &'
476476/// `unblinded_path` to the given `destination`.
477477fn packet_payloads_and_keys < T : CustomOnionMessageContents , S : secp256k1:: Signing + secp256k1:: Verification > (
478478 secp_ctx : & Secp256k1 < S > , unblinded_path : & [ PublicKey ] , destination : Destination ,
479- message : OnionMessageContents < T > , mut reply_path : Option < BlindedRoute > , session_priv : & SecretKey
479+ message : OnionMessageContents < T > , mut reply_path : Option < BlindedPath > , session_priv : & SecretKey
480480) -> Result < ( Vec < ( Payload < T > , [ u8 ; 32 ] ) > , Vec < onion_utils:: OnionKeys > ) , secp256k1:: Error > {
481481 let num_hops = unblinded_path. len ( ) + destination. num_hops ( ) ;
482482 let mut payloads = Vec :: with_capacity ( num_hops) ;
483483 let mut onion_packet_keys = Vec :: with_capacity ( num_hops) ;
484484
485- let ( mut intro_node_id_blinding_pt, num_blinded_hops) = if let Destination :: BlindedRoute ( BlindedRoute {
485+ let ( mut intro_node_id_blinding_pt, num_blinded_hops) = if let Destination :: BlindedPath ( BlindedPath {
486486 introduction_node_id, blinding_point, blinded_hops } ) = & destination {
487487 ( Some ( ( * introduction_node_id, * blinding_point) ) , blinded_hops. len ( ) ) } else { ( None , 0 ) } ;
488488 let num_unblinded_hops = num_hops - num_blinded_hops;
0 commit comments