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 9, 2024
1 parent 2db7565 commit 863deae
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 @@ -4347,7 +4347,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 @@ -10931,6 +10931,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 @@ -523,6 +523,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 863deae

Please sign in to comment.