Skip to content

Commit

Permalink
Add new Bolt12PaymentError for failed blinded path creation.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
valentinewallace committed Sep 12, 2024
1 parent 62f2870 commit 280592f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4381,7 +4381,7 @@ where
Ok(paths) => paths,
Err(()) => {
self.abandon_payment_with_reason(payment_id, PaymentFailureReason::RouteNotFound);
res = Err(Bolt12PaymentError::SendingFailed(RetryableSendFailure::RouteNotFound));
res = Err(Bolt12PaymentError::BlindedPathCreationFailed);
return NotifyOption::DoPersist
}
};
Expand Down Expand Up @@ -11018,6 +11018,12 @@ where
log_trace!($logger, "Failed paying invoice: {:?}", e);
InvoiceError::from_string(format!("{:?}", e))
},
#[cfg(async_payments)]
Err(Bolt12PaymentError::BlindedPathCreationFailed) => {
let err_msg = "Failed to create a blinded path back to ourselves";
log_trace!($logger, "{}", err_msg);
InvoiceError::from_string(err_msg.to_string())
},
Err(Bolt12PaymentError::UnexpectedInvoice)
| Err(Bolt12PaymentError::DuplicateInvoice)
| Ok(()) => return None,
Expand Down
9 changes: 9 additions & 0 deletions lightning/src/ln/outbound_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,15 @@ pub enum Bolt12PaymentError {
UnknownRequiredFeatures,
/// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed.
SendingFailed(RetryableSendFailure),
#[cfg(async_payments)]
/// Failed to create a blinded path back to ourselves.
///
/// We attempted to initiate payment to a [`StaticInvoice`] but failed to create a reply path for
/// our [`HeldHtlcAvailable`] message.
///
/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice
/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable
BlindedPathCreationFailed,
}

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

0 comments on commit 280592f

Please sign in to comment.