Skip to content

Commit 8015eff

Browse files
Don't remove AllPathsFailed outbounds if they're retryable
This makes it easier to retry payments if all paths fail on initial send.
1 parent 61f99af commit 8015eff

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,14 @@ impl OutboundPayments {
652652
} else if has_err {
653653
// If we failed to send any paths, we should remove the new PaymentId from the
654654
// `pending_outbound_payments` map, as the user isn't expected to `abandon_payment`.
655-
let removed = self.pending_outbound_payments.lock().unwrap().remove(&payment_id).is_some();
656-
debug_assert!(removed, "We should always have a pending payment to remove here");
655+
if !self.pending_outbound_payments.lock().unwrap().get(&payment_id)
656+
.map_or(false, |payment| payment.is_retryable())
657+
{
658+
// If we failed to send any paths, we should remove the new PaymentId from the
659+
// `pending_outbound_payments` map, as the user isn't expected to `abandon_payment`.
660+
let removed = self.pending_outbound_payments.lock().unwrap().remove(&payment_id).is_some();
661+
debug_assert!(removed, "We should always have a pending payment to remove here");
662+
}
657663
Err(PaymentSendFailure::AllFailedResendSafe(results.drain(..).map(|r| r.unwrap_err()).collect()))
658664
} else {
659665
Ok(())

0 commit comments

Comments
 (0)