mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-13 14:52:21 +01:00
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..
This commit is contained in:
parent
cdc0c3b581
commit
3945bf86f9
2 changed files with 10 additions and 1 deletions
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue