Skip to content

Commit 26d1582

Browse files
Add new Bolt12PaymentError for failed blinded path creation.
Currently used when initiating an async payment via held_htlc_available OM. This OM needs a reply path back to us, so use this error for our invoice_error OM if we fail to create said reply path.
1 parent 615eefb commit 26d1582

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4381,7 +4381,7 @@ where
43814381
Ok(paths) => paths,
43824382
Err(()) => {
43834383
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
4384-
res = Err(Bolt12PaymentError::SendingFailed(RetryableSendFailure::RouteNotFound));
4384+
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
43854385
return NotifyOption::DoPersist
43864386
}
43874387
};
@@ -11018,6 +11018,12 @@ where
1101811018
log_trace!($logger, "Failed paying invoice: {:?}", e);
1101911019
InvoiceError::from_string(format!("{:?}", e))
1102011020
},
11021+
#[cfg(async_payments)]
11022+
Err(Bolt12PaymentError::BlindedPathCreationFailed) => {
11023+
let err_msg = "Failed to create a blinded path back to ourselves";
11024+
log_trace!($logger, "{}", err_msg);
11025+
InvoiceError::from_string(err_msg.to_string())
11026+
},
1102111027
Err(Bolt12PaymentError::UnexpectedInvoice)
1102211028
| Err(Bolt12PaymentError::DuplicateInvoice)
1102311029
| Ok(()) => return None,

lightning/src/ln/outbound_payment.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,15 @@ pub enum Bolt12PaymentError {
535535
UnknownRequiredFeatures,
536536
/// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed.
537537
SendingFailed(RetryableSendFailure),
538+
#[cfg(async_payments)]
539+
/// Failed to create a blinded path back to ourselves.
540+
///
541+
/// We attempted to initiate payment to a [`StaticInvoice`] but failed to create a reply path for
542+
/// our [`HeldHtlcAvailable`] message.
543+
///
544+
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
545+
/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
546+
BlindedPathCreationFailed,
538547
}
539548

540549
/// Indicates that we failed to send a payment probe. Further errors may be surfaced later via

0 commit comments

Comments
 (0)