From: Valentine Wallace Date: Wed, 11 Sep 2024 17:53:39 +0000 (-0400) Subject: Add new PaymentFailureReason::BlindedPathCreationFailed X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=3945bf86f95373e4ad63749d5dde64643b614790;p=rust-lightning Add new PaymentFailureReason::BlindedPathCreationFailed 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.. --- diff --git a/lightning/src/events/mod.rs b/lightning/src/events/mod.rs index c450c1d91..cd4b140ff 100644 --- a/lightning/src/events/mod.rs +++ b/lightning/src/events/mod.rs @@ -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), diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 3914384ca..6a3fd2275 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -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 }