Skip to content

Commit 3945bf8

Browse files
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..
1 parent cdc0c3b commit 3945bf8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lightning/src/events/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@ pub enum PaymentFailureReason {
577577
///
578578
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
579579
InvoiceRequestRejected,
580+
/// Failed to create a blinded path back to ourselves.
581+
/// We attempted to initiate payment to a static invoice but failed to create a reply path for our
582+
/// [`HeldHtlcAvailable`] message.
583+
///
584+
/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
585+
BlindedPathCreationFailed,
580586
}
581587

582588
impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
@@ -587,6 +593,7 @@ impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
587593
(4, RetriesExhausted) => {},
588594
(5, InvoiceRequestRejected) => {},
589595
(6, PaymentExpired) => {},
596+
(7, BlindedPathCreationFailed) => {},
590597
(8, RouteNotFound) => {},
591598
(10, UnexpectedError) => {},
592599
);
@@ -1651,6 +1658,8 @@ impl Writeable for Event {
16511658
&Some(PaymentFailureReason::RetriesExhausted),
16521659
Some(PaymentFailureReason::InvoiceRequestRejected) =>
16531660
&Some(PaymentFailureReason::RecipientRejected),
1661+
Some(PaymentFailureReason::BlindedPathCreationFailed) =>
1662+
&Some(PaymentFailureReason::RouteNotFound)
16541663
};
16551664
write_tlv_fields!(writer, {
16561665
(0, payment_id, required),

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4463,7 +4463,7 @@ where
44634463
) {
44644464
Ok(paths) => paths,
44654465
Err(()) => {
4466-
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
4466+
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
44674467
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
44684468
return NotifyOption::DoPersist
44694469
}

0 commit comments

Comments
 (0)