Skip to content

Don't auto-fail offers payments pre-HTLC lock in - #4078

Merged
tnull merged 1 commit into
lightningdevkit:mainfrom
valentinewallace:2025-09-abandon-async-payment-fix
Sep 18, 2025
Merged

Don't auto-fail offers payments pre-HTLC lock in#4078
tnull merged 1 commit into
lightningdevkit:mainfrom
valentinewallace:2025-09-abandon-async-payment-fix

Conversation

@valentinewallace

Copy link
Copy Markdown
Contributor

Previously, we had a bug that particularly affected async payments where if an outbound payment was in the state {Static}InvoiceReceived and there was a call to process_pending_htlc_forwards, the payment would be automatically abandoned. We would behave correctly and avoid abandoning if the payment was awaiting an invoice, but not if the payment had an invoice but the HTLCs weren't yet locked in.

Previously, we had a bug that particularly affected async payments where if an
outbound payment was in the state {Static}InvoiceReceived and there was a call
to process_pending_htlc_forwards, the payment would be automatically abandoned.
We would behave correctly and avoid abandoning if the payment was awaiting an
invoice, but not if the payment had an invoice but the HTLCs weren't yet locked
in.
@ldk-reviews-bot

ldk-reviews-bot commented Sep 17, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @joostjager as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@codecov

codecovBot commented Sep 17, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.64%. Comparing base (c71334e) to head (ebb8e79).
⚠️ Report is 9 commits behind head on main.

Files with missing linesPatch %Lines
lightning/src/ln/outbound_payment.rs75.00%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #4078 +/- ##
==========================================
+ Coverage 88.63% 88.64% +0.01% 
==========================================
Files 176 176 Lines 131920 131922 +2 Branches 131920 131922 +2 ==========================================
+ Hits 116927 116948 +21 + Misses 12325 12311 -14 + Partials 2668 2663 -5 
FlagCoverage Δ
fuzzing21.60% <0.00%> (ø)
tests88.48% <83.33%> (+0.01%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

match self {
PendingOutboundPayment::AwaitingInvoice { .. } => true,
PendingOutboundPayment::AwaitingInvoice { .. }
| PendingOutboundPayment::InvoiceReceived { .. }

@joostjagerjoostjagerSep 18, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I thought InvoiceReceived isn't necessary, because the payment is initiated immediately after receiving the invoice. But on a closer look, I think there are also similar gaps that require this check. There is also manual bolt12 invoice payment. No test coverage though I think.

@ldk-reviews-bot

Copy link
Copy Markdown

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Tagging for backporting.

@tnull
tnull merged commit b002e43 into lightningdevkit:mainSep 18, 2025
25 checks passed
@TheBlueMattTheBlueMatt mentioned this pull request Oct 6, 2025
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

Backported in #4143

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@valentinewallace@ldk-reviews-bot@TheBlueMatt@tnull@joostjager