@@ -39,6 +39,7 @@ use crate::offers::invoice::{
39
39
Bolt12Invoice , DerivedSigningPubkey , ExplicitSigningPubkey , InvoiceBuilder ,
40
40
DEFAULT_RELATIVE_EXPIRY ,
41
41
} ;
42
+ use crate :: offers:: invoice_error:: InvoiceError ;
42
43
use crate :: offers:: invoice_request:: {
43
44
CurrencyConversion , InvoiceRequest , InvoiceRequestBuilder , InvoiceRequestVerifiedFromOffer ,
44
45
VerifiedInvoiceRequest ,
@@ -1080,9 +1081,6 @@ where
1080
1081
/// The user must provide a list of [`MessageForwardNode`] that will be used to generate
1081
1082
/// valid reply paths for the counterparty to send back the corresponding [`Bolt12Invoice`]
1082
1083
/// or [`InvoiceError`].
1083
- ///
1084
- /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
1085
- /// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages
1086
1084
pub fn enqueue_invoice_request (
1087
1085
& self , invoice_request : InvoiceRequest , payment_id : PaymentId , nonce : Nonce ,
1088
1086
peers : Vec < MessageForwardNode > ,
@@ -1129,8 +1127,6 @@ where
1129
1127
/// Reply paths are generated from the given `peers` to allow the counterparty to return
1130
1128
/// an [`InvoiceError`] in case they fail to process the invoice. If valid reply paths
1131
1129
/// cannot be constructed, this method returns a [`Bolt12SemanticError::MissingPaths`].
1132
- ///
1133
- /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError
1134
1130
pub fn enqueue_invoice_using_node_id (
1135
1131
& self , invoice : Bolt12Invoice , destination : PublicKey , peers : Vec < MessageForwardNode > ,
1136
1132
) -> Result < ( ) , Bolt12SemanticError > {
@@ -1185,6 +1181,26 @@ where
1185
1181
Ok ( ( ) )
1186
1182
}
1187
1183
1184
+ /// Enqueues an [`InvoiceError`] to be sent to the counterparty via a specified
1185
+ /// [`BlindedMessagePath`].
1186
+ ///
1187
+ /// Since this method returns the invoice error to the counterparty without
1188
+ /// expecting back a response, we enqueue it without a reply path.
1189
+ pub fn enqueue_invoice_error (
1190
+ & self , invoice_error : InvoiceError , path : BlindedMessagePath ,
1191
+ ) -> Result < ( ) , Bolt12SemanticError > {
1192
+ let mut pending_offers_messages = self . pending_offers_messages . lock ( ) . unwrap ( ) ;
1193
+
1194
+ let instructions = MessageSendInstructions :: WithoutReplyPath {
1195
+ destination : Destination :: BlindedPath ( path) ,
1196
+ } ;
1197
+
1198
+ let message = OffersMessage :: InvoiceError ( invoice_error) ;
1199
+ pending_offers_messages. push ( ( message, instructions) ) ;
1200
+
1201
+ Ok ( ( ) )
1202
+ }
1203
+
1188
1204
/// Forwards a [`StaticInvoice`] over the provided [`Responder`] in response to an
1189
1205
/// [`InvoiceRequest`] that we as a static invoice server received on behalf of an often-offline
1190
1206
/// recipient.
@@ -1215,7 +1231,6 @@ where
1215
1231
/// reply paths for the recipient to send back the corresponding [`ReleaseHeldHtlc`] onion message.
1216
1232
///
1217
1233
/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc
1218
- /// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages
1219
1234
pub fn enqueue_held_htlc_available (
1220
1235
& self , invoice : & StaticInvoice , payment_id : PaymentId , peers : Vec < MessageForwardNode > ,
1221
1236
) -> Result < ( ) , Bolt12SemanticError > {
@@ -1247,8 +1262,6 @@ where
1247
1262
/// The user must provide a list of [`MessageForwardNode`] that will be used to generate
1248
1263
/// valid reply paths for the counterparty to send back the corresponding response for
1249
1264
/// the [`DNSSECQuery`] message.
1250
- ///
1251
- /// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages
1252
1265
#[ cfg( feature = "dnssec" ) ]
1253
1266
pub fn enqueue_dns_onion_message (
1254
1267
& self , message : DNSSECQuery , context : DNSResolverContext , dns_resolvers : Vec < Destination > ,
0 commit comments