Skip to content

Commit ab1e405

Browse files
f don't reply on static invoice handling fail
1 parent e7818e6 commit ab1e405

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,17 +4135,15 @@ where
41354135
#[cfg(async_payments)]
41364136
fn initiate_async_payment(
41374137
&self, invoice: &StaticInvoice, payment_id: PaymentId
4138-
) -> Result<(), InvoiceError> {
4139-
if invoice.message_paths().is_empty() { return Err(Bolt12SemanticError::MissingPaths.into()) }
4140-
4138+
) -> Result<(), Bolt12PaymentError> {
41414139
let reply_path = self.create_blinded_path(
41424140
MessageContext::AsyncPayments(AsyncPaymentsContext::OutboundPayment { payment_id })
4143-
).map_err(|_| Bolt12SemanticError::MissingPaths)?;
4141+
).map_err(|_| Bolt12PaymentError::BlindedPathNotFound)?;
41444142

41454143
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
41464144
let payment_release_secret = self.pending_outbound_payments.static_invoice_received(
41474145
invoice, payment_id, &*self.entropy_source
4148-
).map_err(|e| InvoiceError::from_string(format!("{:?}", e)))?;
4146+
)?;
41494147

41504148
let mut pending_async_payments_messages = self.pending_async_payments_messages.lock().unwrap();
41514149
const HTLC_AVAILABLE_LIMIT: usize = 10;
@@ -10684,22 +10682,16 @@ where
1068410682
},
1068510683
#[cfg(async_payments)]
1068610684
OffersMessage::StaticInvoice(invoice) => {
10687-
let responder = match responder {
10688-
Some(responder) => responder,
10689-
None => return ResponseInstruction::NoResponse,
10690-
};
1069110685
let payment_id = match context {
1069210686
OffersContext::OutboundPayment { payment_id } => payment_id,
1069310687
_ => {
10694-
return responder.respond(OffersMessage::InvoiceError(
10695-
InvoiceError::from_string("Unrecognized invoice".to_string())
10696-
))
10688+
return ResponseInstruction::NoResponse
1069710689
}
1069810690
};
10699-
match self.initiate_async_payment(&invoice, payment_id) {
10700-
Ok(()) => return ResponseInstruction::NoResponse,
10701-
Err(e) => responder.respond(OffersMessage::InvoiceError(e)),
10691+
if let Err(e) = self.initiate_async_payment(&invoice, payment_id) {
10692+
log_trace!(self.logger, "Failed to initiate async payment to static invoice: {:?}", e);
1070210693
}
10694+
ResponseInstruction::NoResponse
1070310695
},
1070410696
OffersMessage::InvoiceError(invoice_error) => {
1070510697
abandon_if_payment(context);

lightning/src/ln/outbound_payment.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ pub enum Bolt12PaymentError {
531531
///
532532
/// [`BlindedPath`]: crate::blinded_path::BlindedPath
533533
OnionPacketSizeExceeded,
534+
/// Failed to create a blinded path.
535+
BlindedPathNotFound,
534536
}
535537

536538
/// Indicates that we failed to send a payment probe. Further errors may be surfaced later via

0 commit comments

Comments
 (0)