@@ -98,6 +98,11 @@ pub(super) const MAX_TIMER_TICKS: usize = 2;
9898/// # })
9999/// # }
100100/// # fn create_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
101+ /// # &self, _recipient: PublicKey, _peers: Vec<PublicKey>, _secp_ctx: &Secp256k1<T>
102+ /// # ) -> Result<Vec<BlindedPath>, ()> {
103+ /// # unreachable!()
104+ /// # }
105+ /// # fn create_compact_blinded_paths<T: secp256k1::Signing + secp256k1::Verification>(
101106/// # &self, _recipient: PublicKey, _peers: Vec<ForwardNode>, _secp_ctx: &Secp256k1<T>
102107/// # ) -> Result<Vec<BlindedPath>, ()> {
103108/// # unreachable!()
@@ -340,6 +345,14 @@ pub trait MessageRouter {
340345 /// direct peers with the `recipient`.
341346 fn create_blinded_paths <
342347 T : secp256k1:: Signing + secp256k1:: Verification
348+ > (
349+ & self , recipient : PublicKey , peers : Vec < PublicKey > , secp_ctx : & Secp256k1 < T > ,
350+ ) -> Result < Vec < BlindedPath > , ( ) > ;
351+
352+ /// Creates [`BlindedPath`]s to the `recipient` node. The nodes in `peers` are assumed to be
353+ /// direct peers with the `recipient`.
354+ fn create_compact_blinded_paths <
355+ T : secp256k1:: Signing + secp256k1:: Verification
343356 > (
344357 & self , recipient : PublicKey , peers : Vec < ForwardNode > , secp_ctx : & Secp256k1 < T > ,
345358 ) -> Result < Vec < BlindedPath > , ( ) > ;
@@ -369,7 +382,7 @@ where
369382 I : Iterator < Item = ForwardNode > ,
370383 T : secp256k1:: Signing + secp256k1:: Verification
371384 > (
372- & self , recipient : PublicKey , peers : I , secp_ctx : & Secp256k1 < T > ,
385+ & self , recipient : PublicKey , peers : I , secp_ctx : & Secp256k1 < T > , compact_paths : bool
373386 ) -> Result < Vec < BlindedPath > , ( ) > {
374387 // Limit the number of blinded paths that are computed.
375388 const MAX_PATHS : usize = 3 ;
@@ -417,8 +430,11 @@ where
417430 }
418431 } ,
419432 } ?;
420- for path in & mut paths {
421- path. use_compact_introduction_node ( & network_graph) ;
433+
434+ if compact_paths {
435+ for path in & mut paths {
436+ path. use_compact_introduction_node ( & network_graph) ;
437+ }
422438 }
423439
424440 Ok ( paths)
@@ -466,10 +482,21 @@ where
466482
467483 fn create_blinded_paths <
468484 T : secp256k1:: Signing + secp256k1:: Verification
485+ > (
486+ & self , recipient : PublicKey , peers : Vec < PublicKey > , secp_ctx : & Secp256k1 < T > ,
487+ ) -> Result < Vec < BlindedPath > , ( ) > {
488+ let peers = peers
489+ . into_iter ( )
490+ . map ( |node_id| ForwardNode { node_id, short_channel_id : None } ) ;
491+ self . create_blinded_paths_from_iter ( recipient, peers, secp_ctx, false )
492+ }
493+
494+ fn create_compact_blinded_paths <
495+ T : secp256k1:: Signing + secp256k1:: Verification
469496 > (
470497 & self , recipient : PublicKey , peers : Vec < ForwardNode > , secp_ctx : & Secp256k1 < T > ,
471498 ) -> Result < Vec < BlindedPath > , ( ) > {
472- self . create_blinded_paths_from_iter ( recipient, peers. into_iter ( ) , secp_ctx)
499+ self . create_blinded_paths_from_iter ( recipient, peers. into_iter ( ) , secp_ctx, true )
473500 }
474501}
475502
0 commit comments