From: Valentine Wallace Date: Fri, 6 Sep 2024 19:28:43 +0000 (-0400) Subject: Add new Bolt12PaymentError for failed blinded path creation. X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=26d1582c3bbd2cb36758c7ea52516b6eaae85b56;p=rust-lightning Add new Bolt12PaymentError for failed blinded path creation. Currently used when initiating an async payment via held_htlc_available OM. This OM needs a reply path back to us, so use this error for our invoice_error OM if we fail to create said reply path. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index b2f182a63..63faa91f5 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -4381,7 +4381,7 @@ where Ok(paths) => paths, Err(()) => { self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound); - res = Err(Bolt12PaymentError::SendingFailed(RetryableSendFailure::RouteNotFound)); + res = Err(Bolt12PaymentError::BlindedPathCreationFailed); return NotifyOption::DoPersist } }; @@ -11018,6 +11018,12 @@ where log_trace!($logger, "Failed paying invoice: {:?}", e); InvoiceError::from_string(format!("{:?}", e)) }, + #[cfg(async_payments)] + Err(Bolt12PaymentError::BlindedPathCreationFailed) => { + let err_msg = "Failed to create a blinded path back to ourselves"; + log_trace!($logger, "{}", err_msg); + InvoiceError::from_string(err_msg.to_string()) + }, Err(Bolt12PaymentError::UnexpectedInvoice) | Err(Bolt12PaymentError::DuplicateInvoice) | Ok(()) => return None, diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index 65563325c..092f1a7fc 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -535,6 +535,15 @@ pub enum Bolt12PaymentError { UnknownRequiredFeatures, /// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. SendingFailed(RetryableSendFailure), + #[cfg(async_payments)] + /// Failed to create a blinded path back to ourselves. + /// + /// We attempted to initiate payment to a [`StaticInvoice`] but failed to create a reply path for + /// our [`HeldHtlcAvailable`] message. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + BlindedPathCreationFailed, } /// Indicates that we failed to send a payment probe. Further errors may be surfaced later via