Skip to content

Commit 20b8704

Browse files
committed
Add Bolt12PaymentError::SendingFailed variant
Instead of returning Ok when path finding fails, allow returning a RetryableSendFailure from send_payment_for_bolt12_invoice. Follow up commits will return such failures.
1 parent 127016f commit 20b8704

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lightning/src/ln/max_payment_path_len_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ fn bolt12_invoice_too_large_blinded_paths() {
388388
let invoice_om = nodes[1].onion_messenger.next_onion_message_for_peer(nodes[0].node.get_our_node_id()).unwrap();
389389
nodes[0].onion_messenger.handle_onion_message(&nodes[1].node.get_our_node_id(), &invoice_om);
390390
// TODO: assert on the invoice error once we support replying to invoice OMs with failure info
391-
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager", "Failed paying invoice: OnionPacketSizeExceeded", 1);
391+
nodes[0].logger.assert_log_contains("lightning::ln::channelmanager", "Failed paying invoice: SendingFailed(OnionPacketSizeExceeded)", 1);
392392

393393
let events = nodes[0].node.get_and_clear_pending_events();
394394
assert_eq!(events.len(), 1);

lightning/src/ln/outbound_payment.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,8 @@ pub enum Bolt12PaymentError {
510510
UnexpectedInvoice,
511511
/// Payment for an invoice with the corresponding [`PaymentId`] was already initiated.
512512
DuplicateInvoice,
513-
/// The [`BlindedPath`]s provided are too large and caused us to exceed the maximum onion hop data
514-
/// size of 1300 bytes.
515-
///
516-
/// [`BlindedPath`]: crate::blinded_path::BlindedPath
517-
OnionPacketSizeExceeded,
513+
/// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed.
514+
SendingFailed(RetryableSendFailure),
518515
}
519516

520517
/// Indicates that we failed to send a payment probe. Further errors may be surfaced later via
@@ -848,7 +845,7 @@ impl OutboundPayments {
848845
.map_err(|()| {
849846
log_error!(logger, "Can't construct an onion packet without exceeding 1300-byte onion \
850847
hop_data length for payment with id {} and hash {}", payment_id, payment_hash);
851-
Bolt12PaymentError::OnionPacketSizeExceeded
848+
Bolt12PaymentError::SendingFailed(RetryableSendFailure::OnionPacketSizeExceeded)
852849
})?;
853850

854851
if let Some(max_fee_msat) = max_total_routing_fee_msat {

0 commit comments

Comments
 (0)