]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Add new PaymentFailureReason::BlindedPathCreationFailed
authorValentine Wallace <vwallace@protonmail.com>
Wed, 11 Sep 2024 17:53:39 +0000 (13:53 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 30 Oct 2024 20:13:56 +0000 (16:13 -0400)
RouteNotFound did not fit here because that error is reserved for failing to
find a route for a payment, whereas here we are failing to create a blinded
path back to ourselves..

lightning/src/events/mod.rs
lightning/src/ln/channelmanager.rs

index c450c1d91cd9a958ce65dff5bbd65239c6a1898f..cd4b140ffeb3bf03341aab8cbb59742c23b75463 100644 (file)
@@ -577,6 +577,12 @@ pub enum PaymentFailureReason {
        ///
        /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
        InvoiceRequestRejected,
+       /// Failed to create a blinded path back to ourselves.
+       /// We attempted to initiate payment to a static invoice but failed to create a reply path for our
+       /// [`HeldHtlcAvailable`] message.
+       ///
+       /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
+       BlindedPathCreationFailed,
 }
 
 impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
@@ -587,6 +593,7 @@ impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
        (4, RetriesExhausted) => {},
        (5, InvoiceRequestRejected) => {},
        (6, PaymentExpired) => {},
+       (7, BlindedPathCreationFailed) => {},
        (8, RouteNotFound) => {},
        (10, UnexpectedError) => {},
 );
@@ -1651,6 +1658,8 @@ impl Writeable for Event {
                                                &Some(PaymentFailureReason::RetriesExhausted),
                                        Some(PaymentFailureReason::InvoiceRequestRejected) =>
                                                &Some(PaymentFailureReason::RecipientRejected),
+                                       Some(PaymentFailureReason::BlindedPathCreationFailed) =>
+                                               &Some(PaymentFailureReason::RouteNotFound)
                                };
                                write_tlv_fields!(writer, {
                                        (0, payment_id, required),
index 3914384ca82d5565e2ab81576ab73889cdd227f1..6a3fd22751b76285c0938f875227b4de0b18733d 100644 (file)
@@ -4463,7 +4463,7 @@ where
                        ) {
                                Ok(paths) => paths,
                                Err(()) => {
-                                       self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
+                                       self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
                                        res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
                                        return NotifyOption::DoPersist
                                }