@@ -172,14 +172,6 @@ pub trait OffersMessageCommons {
172
172
& self ,
173
173
) -> Vec < ( PaymentId , RetryableInvoiceRequest ) > ;
174
174
175
- /// Creates a collection of blinded paths by delegating to
176
- /// [`MessageRouter::create_blinded_paths`].
177
- ///
178
- /// Errors if the `MessageRouter` errors.
179
- ///
180
- /// [`MessageRouter::create_blinded_paths`]: crate::onion_message::messenger::MessageRouter::create_blinded_paths
181
- fn create_blinded_paths ( & self , context : MessageContext ) -> Result < Vec < BlindedMessagePath > , ( ) > ;
182
-
183
175
/// Enqueue invoice request
184
176
fn enqueue_invoice_request (
185
177
& self , invoice_request : InvoiceRequest , reply_paths : Vec < BlindedMessagePath > ,
@@ -674,7 +666,7 @@ where
674
666
if absolute_expiry. unwrap_or ( Duration :: MAX ) <= max_short_lived_absolute_expiry {
675
667
self . create_compact_blinded_paths ( context)
676
668
} else {
677
- self . commons . create_blinded_paths ( MessageContext :: Offers ( context) )
669
+ self . create_blinded_paths ( MessageContext :: Offers ( context) )
678
670
}
679
671
}
680
672
@@ -689,6 +681,26 @@ where
689
681
now
690
682
}
691
683
684
+ /// Creates a collection of blinded paths by delegating to
685
+ /// [`MessageRouter::create_blinded_paths`].
686
+ ///
687
+ /// Errors if the `MessageRouter` errors.
688
+ ///
689
+ /// [`MessageRouter::create_blinded_paths`]: crate::onion_message::messenger::MessageRouter::create_blinded_paths
690
+ pub fn create_blinded_paths (
691
+ & self , context : MessageContext ,
692
+ ) -> Result < Vec < BlindedMessagePath > , ( ) > {
693
+ let recipient = self . get_our_node_id ( ) ;
694
+ let secp_ctx = & self . secp_ctx ;
695
+
696
+ let peers =
697
+ self . commons . get_peer_for_blinded_path ( ) . into_iter ( ) . map ( |node| node. node_id ) . collect ( ) ;
698
+
699
+ self . message_router
700
+ . create_blinded_paths ( recipient, context, peers, secp_ctx)
701
+ . and_then ( |paths| ( !paths. is_empty ( ) ) . then ( || paths) . ok_or ( ( ) ) )
702
+ }
703
+
692
704
/// Creates a collection of blinded paths by delegating to
693
705
/// [`MessageRouter::create_compact_blinded_paths`].
694
706
///
@@ -759,10 +771,8 @@ where
759
771
nonce,
760
772
hmac : Some ( hmac) ,
761
773
} ) ;
762
- let reply_paths = self
763
- . commons
764
- . create_blinded_paths ( context)
765
- . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
774
+ let reply_paths =
775
+ self . create_blinded_paths ( context) . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
766
776
767
777
create_pending_payment ( & invoice_request, nonce) ?;
768
778
@@ -1032,7 +1042,7 @@ where
1032
1042
nonce,
1033
1043
hmac : Some ( hmac) ,
1034
1044
} ) ;
1035
- match self . commons . create_blinded_paths ( context) {
1045
+ match self . create_blinded_paths ( context) {
1036
1046
Ok ( reply_paths) => {
1037
1047
match self . commons . enqueue_invoice_request ( invoice_request, reply_paths) {
1038
1048
Ok ( _) => { } ,
@@ -1385,7 +1395,6 @@ where
1385
1395
hmac,
1386
1396
} ) ;
1387
1397
let reply_paths = self
1388
- . commons
1389
1398
. create_blinded_paths ( context)
1390
1399
. map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
1391
1400
@@ -1473,8 +1482,7 @@ where
1473
1482
name,
1474
1483
& * self . entropy_source ,
1475
1484
) ?;
1476
- let reply_paths =
1477
- self . commons . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1485
+ let reply_paths = self . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1478
1486
let expiration = StaleExpiration :: TimerTicks ( 1 ) ;
1479
1487
self . commons . add_new_awaiting_offer (
1480
1488
payment_id,
0 commit comments