@@ -167,14 +167,6 @@ pub trait OffersMessageCommons {
167
167
& self ,
168
168
) -> Vec < ( PaymentId , RetryableInvoiceRequest ) > ;
169
169
170
- /// Creates a collection of blinded paths by delegating to
171
- /// [`MessageRouter::create_blinded_paths`].
172
- ///
173
- /// Errors if the `MessageRouter` errors.
174
- ///
175
- /// [`MessageRouter::create_blinded_paths`]: crate::onion_message::messenger::MessageRouter::create_blinded_paths
176
- fn create_blinded_paths ( & self , context : MessageContext ) -> Result < Vec < BlindedMessagePath > , ( ) > ;
177
-
178
170
/// Enqueue invoice request
179
171
fn enqueue_invoice_request (
180
172
& self , invoice_request : InvoiceRequest , reply_paths : Vec < BlindedMessagePath > ,
@@ -686,7 +678,7 @@ where
686
678
if absolute_expiry. unwrap_or ( Duration :: MAX ) <= max_short_lived_absolute_expiry {
687
679
self . create_compact_blinded_paths ( context)
688
680
} else {
689
- self . commons . create_blinded_paths ( MessageContext :: Offers ( context) )
681
+ self . create_blinded_paths ( MessageContext :: Offers ( context) )
690
682
}
691
683
}
692
684
@@ -701,6 +693,26 @@ where
701
693
now
702
694
}
703
695
696
+ /// Creates a collection of blinded paths by delegating to
697
+ /// [`MessageRouter::create_blinded_paths`].
698
+ ///
699
+ /// Errors if the `MessageRouter` errors.
700
+ ///
701
+ /// [`MessageRouter::create_blinded_paths`]: crate::onion_message::messenger::MessageRouter::create_blinded_paths
702
+ pub fn create_blinded_paths (
703
+ & self , context : MessageContext ,
704
+ ) -> Result < Vec < BlindedMessagePath > , ( ) > {
705
+ let recipient = self . get_our_node_id ( ) ;
706
+ let secp_ctx = & self . secp_ctx ;
707
+
708
+ let peers =
709
+ self . commons . get_peer_for_blinded_path ( ) . into_iter ( ) . map ( |node| node. node_id ) . collect ( ) ;
710
+
711
+ self . message_router
712
+ . create_blinded_paths ( recipient, context, peers, secp_ctx)
713
+ . and_then ( |paths| ( !paths. is_empty ( ) ) . then ( || paths) . ok_or ( ( ) ) )
714
+ }
715
+
704
716
/// Creates a collection of blinded paths by delegating to
705
717
/// [`MessageRouter::create_compact_blinded_paths`].
706
718
///
@@ -771,10 +783,8 @@ where
771
783
nonce,
772
784
hmac : Some ( hmac) ,
773
785
} ) ;
774
- let reply_paths = self
775
- . commons
776
- . create_blinded_paths ( context)
777
- . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
786
+ let reply_paths =
787
+ self . create_blinded_paths ( context) . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
778
788
779
789
create_pending_payment ( & invoice_request, nonce) ?;
780
790
@@ -1043,7 +1053,7 @@ where
1043
1053
nonce,
1044
1054
hmac : Some ( hmac) ,
1045
1055
} ) ;
1046
- match self . commons . create_blinded_paths ( context) {
1056
+ match self . create_blinded_paths ( context) {
1047
1057
Ok ( reply_paths) => {
1048
1058
match self . commons . enqueue_invoice_request ( invoice_request, reply_paths) {
1049
1059
Ok ( _) => { } ,
@@ -1396,7 +1406,6 @@ where
1396
1406
hmac,
1397
1407
} ) ;
1398
1408
let reply_paths = self
1399
- . commons
1400
1409
. create_blinded_paths ( context)
1401
1410
. map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
1402
1411
@@ -1484,8 +1493,7 @@ where
1484
1493
name,
1485
1494
& * self . entropy_source ,
1486
1495
) ?;
1487
- let reply_paths =
1488
- self . commons . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1496
+ let reply_paths = self . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1489
1497
let expiration = StaleExpiration :: TimerTicks ( 1 ) ;
1490
1498
self . commons . add_new_awaiting_offer (
1491
1499
payment_id,
0 commit comments