@@ -98,6 +98,11 @@ pub(super) const MAX_TIMER_TICKS: usize = 2;
98
98
/// # })
99
99
/// # }
100
100
/// # 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>(
101
106
/// # &self, _recipient: PublicKey, _peers: Vec<ForwardNode>, _secp_ctx: &Secp256k1<T>
102
107
/// # ) -> Result<Vec<BlindedPath>, ()> {
103
108
/// # unreachable!()
@@ -340,6 +345,14 @@ pub trait MessageRouter {
340
345
/// direct peers with the `recipient`.
341
346
fn create_blinded_paths <
342
347
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
343
356
> (
344
357
& self , recipient : PublicKey , peers : Vec < ForwardNode > , secp_ctx : & Secp256k1 < T > ,
345
358
) -> Result < Vec < BlindedPath > , ( ) > ;
@@ -369,7 +382,7 @@ where
369
382
I : Iterator < Item = ForwardNode > ,
370
383
T : secp256k1:: Signing + secp256k1:: Verification
371
384
> (
372
- & self , recipient : PublicKey , peers : I , secp_ctx : & Secp256k1 < T > ,
385
+ & self , recipient : PublicKey , peers : I , secp_ctx : & Secp256k1 < T > , compact_paths : bool
373
386
) -> Result < Vec < BlindedPath > , ( ) > {
374
387
// Limit the number of blinded paths that are computed.
375
388
const MAX_PATHS : usize = 3 ;
@@ -417,8 +430,11 @@ where
417
430
}
418
431
} ,
419
432
} ?;
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
+ }
422
438
}
423
439
424
440
Ok ( paths)
@@ -466,10 +482,21 @@ where
466
482
467
483
fn create_blinded_paths <
468
484
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
469
496
> (
470
497
& self , recipient : PublicKey , peers : Vec < ForwardNode > , secp_ctx : & Secp256k1 < T > ,
471
498
) -> 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 )
473
500
}
474
501
}
475
502
0 commit comments