@@ -39,6 +39,7 @@ use crate::offers::invoice::{
3939 Bolt12Invoice , DerivedSigningPubkey , ExplicitSigningPubkey , InvoiceBuilder ,
4040 DEFAULT_RELATIVE_EXPIRY ,
4141} ;
42+ use crate :: offers:: invoice_error:: InvoiceError ;
4243use crate :: offers:: invoice_request:: {
4344 CurrencyConversion , InvoiceRequest , InvoiceRequestBuilder , InvoiceRequestVerifiedFromOffer ,
4445 VerifiedInvoiceRequest ,
@@ -1114,9 +1115,6 @@ where
11141115 /// The user must provide a list of [`MessageForwardNode`] that will be used to generate
11151116 /// valid reply paths for the counterparty to send back the corresponding [`Bolt12Invoice`]
11161117 /// or [`InvoiceError`].
1117- ///
1118- /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
1119- /// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages
11201118 pub fn enqueue_invoice_request (
11211119 & self , invoice_request : InvoiceRequest , payment_id : PaymentId , nonce : Nonce ,
11221120 peers : Vec < MessageForwardNode > ,
@@ -1163,8 +1161,6 @@ where
11631161 /// Reply paths are generated from the given `peers` to allow the counterparty to return
11641162 /// an [`InvoiceError`] in case they fail to process the invoice. If valid reply paths
11651163 /// cannot be constructed, this method returns a [`Bolt12SemanticError::MissingPaths`].
1166- ///
1167- /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
11681164 pub fn enqueue_invoice_using_node_id (
11691165 & self , invoice : Bolt12Invoice , destination : PublicKey , peers : Vec < MessageForwardNode > ,
11701166 ) -> Result < ( ) , Bolt12SemanticError > {
@@ -1219,6 +1215,26 @@ where
12191215 Ok ( ( ) )
12201216 }
12211217
1218+ /// Enqueues an [`InvoiceError`] to be sent to the counterparty via a specified
1219+ /// [`BlindedMessagePath`].
1220+ ///
1221+ /// Since this method returns the invoice error to the counterparty without
1222+ /// expecting back a response, we enqueue it without a reply path.
1223+ pub fn enqueue_invoice_error (
1224+ & self , invoice_error : InvoiceError , path : BlindedMessagePath ,
1225+ ) -> Result < ( ) , Bolt12SemanticError > {
1226+ let mut pending_offers_messages = self . pending_offers_messages . lock ( ) . unwrap ( ) ;
1227+
1228+ let instructions = MessageSendInstructions :: WithoutReplyPath {
1229+ destination : Destination :: BlindedPath ( path) ,
1230+ } ;
1231+
1232+ let message = OffersMessage :: InvoiceError ( invoice_error) ;
1233+ pending_offers_messages. push ( ( message, instructions) ) ;
1234+
1235+ Ok ( ( ) )
1236+ }
1237+
12221238 /// Forwards a [`StaticInvoice`] over the provided [`Responder`] in response to an
12231239 /// [`InvoiceRequest`] that we as a static invoice server received on behalf of an often-offline
12241240 /// recipient.
@@ -1266,7 +1282,6 @@ where
12661282 /// contained within the provided [`StaticInvoice`].
12671283 ///
12681284 /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc
1269- /// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages
12701285 pub fn enqueue_held_htlc_available (
12711286 & self , invoice : & StaticInvoice , reply_path_params : HeldHtlcReplyPath ,
12721287 ) -> Result < ( ) , Bolt12SemanticError > {
@@ -1343,8 +1358,6 @@ where
13431358 /// The user must provide a list of [`MessageForwardNode`] that will be used to generate
13441359 /// valid reply paths for the counterparty to send back the corresponding response for
13451360 /// the [`DNSSECQuery`] message.
1346- ///
1347- /// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages
13481361 #[ cfg( feature = "dnssec" ) ]
13491362 pub fn enqueue_dns_onion_message (
13501363 & self , message : DNSSECQuery , context : DNSResolverContext , dns_resolvers : Vec < Destination > ,
0 commit comments