Skip to content

Commit 2c75cbb

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 b8adb8d commit 2c75cbb

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,
@@ -589,6 +595,7 @@ impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
589595
(6, PaymentExpired) => {},
590596
(8, RouteNotFound) => {},
591597
(10, UnexpectedError) => {},
598+
(12, BlindedPathCreationFailed) => {},
592599
);
593600

594601
/// An Event which you should probably take some action in response to.
@@ -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
@@ -4456,7 +4456,7 @@ where
44564456
) {
44574457
Ok(paths) => paths,
44584458
Err(()) => {
4459-
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
4459+
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
44604460
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
44614461
return NotifyOption::DoPersist
44624462
}

0 commit comments

Comments
 (0)