Skip to content

Commit 3e1af19

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 ec818b8 commit 3e1af19

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
@@ -576,6 +576,12 @@ pub enum PaymentFailureReason {
576576
///
577577
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
578578
InvoiceRequestRejected,
579+
/// Failed to create a blinded path back to ourselves.
580+
/// We attempted to initiate payment to a static invoice but failed to create a reply path for our
581+
/// [`HeldHtlcAvailable`] message.
582+
///
583+
/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
584+
BlindedPathCreationFailed,
579585
}
580586

581587
impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
@@ -588,6 +594,7 @@ impl_writeable_tlv_based_enum_upgradable!(PaymentFailureReason,
588594
(6, PaymentExpired) => {},
589595
(8, RouteNotFound) => {},
590596
(10, UnexpectedError) => {},
597+
(12, BlindedPathCreationFailed) => {},
591598
);
592599

593600
/// An Event which you should probably take some action in response to.
@@ -1620,6 +1627,8 @@ impl Writeable for Event {
16201627
&Some(PaymentFailureReason::RetriesExhausted),
16211628
Some(PaymentFailureReason::InvoiceRequestRejected) =>
16221629
&Some(PaymentFailureReason::RecipientRejected),
1630+
Some(PaymentFailureReason::BlindedPathCreationFailed) =>
1631+
&Some(PaymentFailureReason::RouteNotFound)
16231632
};
16241633
write_tlv_fields!(writer, {
16251634
(0, payment_id, required),

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4380,7 +4380,7 @@ where
43804380
) {
43814381
Ok(paths) => paths,
43824382
Err(()) => {
4383-
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
4383+
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::BlindedPathCreationFailed);
43844384
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
43854385
return NotifyOption::DoPersist
43864386
}

0 commit comments

Comments
 (0)