@@ -177,14 +177,6 @@ pub trait OffersMessageCommons {
177177 & self ,
178178 ) -> Vec < ( PaymentId , RetryableInvoiceRequest ) > ;
179179
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-
188180 /// Enqueue invoice request
189181 fn enqueue_invoice_request (
190182 & self , invoice_request : InvoiceRequest , reply_paths : Vec < BlindedMessagePath > ,
@@ -696,7 +688,7 @@ where
696688 if absolute_expiry. unwrap_or ( Duration :: MAX ) <= max_short_lived_absolute_expiry {
697689 self . create_compact_blinded_paths ( context)
698690 } else {
699- self . commons . create_blinded_paths ( MessageContext :: Offers ( context) )
691+ self . create_blinded_paths ( MessageContext :: Offers ( context) )
700692 }
701693 }
702694
@@ -711,6 +703,26 @@ where
711703 now
712704 }
713705
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+
714726 /// Creates a collection of blinded paths by delegating to
715727 /// [`MessageRouter::create_compact_blinded_paths`].
716728 ///
@@ -781,10 +793,8 @@ where
781793 nonce,
782794 hmac : Some ( hmac) ,
783795 } ) ;
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 ) ?;
788798
789799 create_pending_payment ( & invoice_request, nonce) ?;
790800
@@ -1054,7 +1064,7 @@ where
10541064 nonce,
10551065 hmac : Some ( hmac) ,
10561066 } ) ;
1057- match self . commons . create_blinded_paths ( context) {
1067+ match self . create_blinded_paths ( context) {
10581068 Ok ( reply_paths) => {
10591069 match self . commons . enqueue_invoice_request ( invoice_request, reply_paths) {
10601070 Ok ( _) => { } ,
@@ -1512,7 +1522,6 @@ where
15121522 hmac,
15131523 } ) ;
15141524 let reply_paths = self
1515- . commons
15161525 . create_blinded_paths ( context)
15171526 . map_err ( |_| Bolt12SemanticError :: MissingPaths ) ?;
15181527
@@ -1600,8 +1609,7 @@ where
16001609 name,
16011610 & * self . entropy_source ,
16021611 ) ?;
1603- let reply_paths =
1604- self . commons . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
1612+ let reply_paths = self . create_blinded_paths ( MessageContext :: DNSResolver ( context) ) ?;
16051613 let expiration = StaleExpiration :: TimerTicks ( 1 ) ;
16061614 self . commons . add_new_awaiting_offer (
16071615 payment_id,
0 commit comments