@@ -177,14 +177,6 @@ pub trait OffersMessageCommons {
177
177
& self ,
178
178
) -> Vec < ( PaymentId , RetryableInvoiceRequest ) > ;
179
179
180
- /// Creates a collection of blinded paths by delegating to
181
- /// [`MessageRouter::create_blinded_paths`].
182
- ///
183
- /// Errors if the `MessageRouter` errors.
184
- ///
185
- /// [`MessageRouter::create_blinded_paths`]: crate::onion_message::messenger::MessageRouter::create_blinded_paths
186
- fn create_blinded_paths ( & self , context : MessageContext ) -> Result < Vec < BlindedMessagePath > , ( ) > ;
187
-
188
180
/// Enqueue invoice request
189
181
fn enqueue_invoice_request (
190
182
& self , invoice_request : InvoiceRequest , reply_paths : Vec < BlindedMessagePath > ,
@@ -696,7 +688,7 @@ where
696
688
if absolute_expiry. unwrap_or ( Duration :: MAX ) <= max_short_lived_absolute_expiry {
697
689
self . create_compact_blinded_paths ( context)
698
690
} else {
699
- self . commons . create_blinded_paths ( MessageContext :: Offers ( context) )
691
+ self . create_blinded_paths ( MessageContext :: Offers ( context) )
700
692
}
701
693
}
702
694
@@ -711,6 +703,26 @@ where
711
703
now
712
704
}
713
705
706
+ /// Creates a collection of blinded paths by delegating to
707
+ /// [`MessageRouter::create_blinded_paths`].
708
+ ///
709
+ /// Errors if the `MessageRouter` errors.
710
+ ///
711
+ /// [`MessageRouter::create_blinded_paths`]: crate::onion_message::messenger::MessageRouter::create_blinded_paths
712
+ pub fn create_blinded_paths (
713
+ & self , context : MessageContext ,
714
+ ) -> Result < Vec < BlindedMessagePath > , ( ) > {
715
+ let recipient = self . get_our_node_id ( ) ;
716
+ let secp_ctx = & self . secp_ctx ;
717
+
718
+ let peers =
719
+ self . commons . get_peer_for_blinded_path ( ) . into_iter ( ) . map ( |node| node. node_id ) . collect ( ) ;
720
+
721
+ self . message_router
722
+ . create_blinded_paths ( recipient, context, peers, secp_ctx)
723
+ . and_then ( |paths| ( !paths. is_empty ( ) ) . then ( || paths) . ok_or ( ( ) ) )
724
+ }
725
+
714
726
/// Creates a collection of blinded paths by delegating to
715
727
/// [`MessageRouter::create_compact_blinded_paths`].
716
728
///
@@ -781,10 +793,8 @@ where
781
793
nonce,
782
794
hmac : Some ( hmac) ,
783
795
} ) ;
784
- let reply_paths = self
785
- . commons
786
- . create_blinded_paths ( context)
787
- . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
796
+ let reply_paths =
797
+ self . create_blinded_paths ( context) . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
788
798
789
799
create_pending_payment ( & invoice_request, nonce) ?;
790
800
@@ -1054,7 +1064,7 @@ where
1054
1064
nonce,
1055
1065
hmac : Some ( hmac) ,
1056
1066
} ) ;
1057
- match self . commons . create_blinded_paths ( context) {
1067
+ match self . create_blinded_paths ( context) {
1058
1068
Ok ( reply_paths) => {
1059
1069
match self . commons . enqueue_invoice_request ( invoice_request, reply_paths) {
1060
1070
Ok ( _) => { } ,
@@ -1512,7 +1522,6 @@ where
1512
1522
hmac,
1513
1523
} ) ;
1514
1524
let reply_paths = self
1515
- . commons
1516
1525
. create_blinded_paths ( context)
1517
1526
. map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
1518
1527
@@ -1600,8 +1609,7 @@ where
1600
1609
name,
1601
1610
& * self . entropy_source ,
1602
1611
) ?;
1603
- let reply_paths =
1604
- self . commons . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1612
+ let reply_paths = self . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1605
1613
let expiration = StaleExpiration :: TimerTicks ( 1 ) ;
1606
1614
self . commons . add_new_awaiting_offer (
1607
1615
payment_id,
0 commit comments