Skip to content

Fixes to payment claim handling - #1157

Merged
tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2026-09-claim-fixes
Oct 12, 2026
Merged

tnull merged 3 commits into
lightningdevkit:mainfrom
TheBlueMatt:2026-09-claim-fixes

Conversation

@TheBlueMatt

Copy link
Copy Markdown
Contributor

Various tweaks to payment success criteria to make it more robust against surprising changes after resolution (or though-resolution in the case of the claimable-payment commit).

If we have sent an outbound payment with a given `payment_hash` and
we receive an inbound payment with a matching `payment_hash`, its
possible this is an indication of a payment loop, but its also
possible its simply a random HTLC with the same hash. We should,
thus, not update the outbound payment's status, as it might still
be pending and complete. We can detect the payment's failure when
the HTLC failure comes back to us as the sender.
If we have already received a payment and marked it as
`PaymentStatus::Succeeded` before receiving a second HTLC with the
same `payment_hash`, we should leave the payment at
`PaymentStatus::Succeeded` rather than reverting it to failed.
`ChannelManager::claim_funds` fails if there are any custom even
TLVs. While this is documented, its somewhat deadly for swap
services - they might release the preimage in response to a
`PaymentClaimable` event and assume they can definitely claim the
payment, but LDK will refuse to do so.

The `lightning` crate really needs to fix this API for the next
release, but for now we should avoid having such an obvious API
hole in `ldk-node`.
@ldk-reviews-bot

ldk-reviews-bot commented Oct 12, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tnull 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.

@tnull
tnull self-requested a review October 12, 2026 11:41
@tnull
tnull merged commit 5640754 into lightningdevkit:main Oct 12, 2026
14 of 25 checks passed
Sign up for free to 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.

3 participants