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
joemphilips added a commit to joemphilips/cdk that referenced this pull request Nov 11, 2026
ldk-node 0.7.0 marks an in-flight outbound payment Failed when an
inbound HTLC uses the same payment hash. cdk-ldk-node reports that
status as a failed melt. A melt requester who holds the HTLC of their
own invoice and keysends the same hash to the mint could thus release
the melt proofs and then settle the HTLC.

ldk-node 0.7.1 fixes these bugs:
- an inbound HTLC that reuses an outbound payment hash no longer fails
  the outbound payment (lightningdevkit/ldk-node#1157);
- a late PaymentFailed no longer overwrites a succeeded payment
  (lightningdevkit/ldk-node#1065);
- a ChannelManager read error stops the build instead of starting a
  fresh node (lightningdevkit/ldk-node#1032).

lightning 0.2.8 (with lightning-liquidity, lightning-transaction-sync
and lightning-persister 0.2.8, and lightning-invoice 0.34.2) fixes:
- a malicious BOLT11 route hint that removes channels from the graph
  (lightningdevkit/rust-lightning#5503);
- an MPP startup panic after a channel monitor is archived (#5528);
- a ChannelManager that fails to load after several payments to one
  hash (#5541);
- anchor commitments held back when the fee-bump input cannot be
  funded (4825c089e);
- 64-byte transactions skipped in Esplora sync (#5559).

Only these six packages change in Cargo.lock and Cargo.lock.msrv.
cargo update also re-resolved unrelated multi-version range
dependencies, so those edges keep their earlier versions. The other
LDK crates are already at their latest compatible releases. The
workspace floors now require the fixed versions, so a regenerated lock
cannot select the vulnerable ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDmqYFNSovaSho9M89aXC9
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