]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add new Bolt12PaymentError for failed blinded path creation.
authorValentine Wallace <vwallace@protonmail.com>
Fri, 6 Sep 2024 19:28:43 +0000 (15:28 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Fri, 13 Sep 2024 14:40:06 +0000 (10:40 -0400)
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.

lightning/src/ln/channelmanager.rs
lightning/src/ln/outbound_payment.rs

index b2f182a6365fb9e28cbb01ff097b91e3c5e0a420..63faa91f583938bd1d4ebad19cd70fd6cc19a529 100644 (file)
@@ -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,
index 65563325c8fdcd5713a0b530d2b5162eb618abc7..092f1a7fc202e274d2e64c6bd31cd0480ec5624d 100644 (file)
@@ -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