Skip to content

Conversation

TheBlueMatt
Copy link
Collaborator

Backport of #4154 and release notes/version bump

wpaulino and others added 3 commits October 10, 2025 16:44
We plan to rework this method in the following commit, so we start by
formatting it first.

Backport of 2fbaf96

Conflicts resolved in:
 * lightning/src/chain/channelmonitor.rs
Previously, we'd attempt to claim all HTLCs that have expired or that we
have the preimage for on each preimage monitor update. This happened due
to reusing the code path (`get_counterparty_output_claim_info`) used
when producing all claims for a newly confirmed counterparty commitment.
Unfortunately, this can result in invalid claim transactions and
ultimately in loss of funds (if the HTLC expires and the counterparty
claims it via the timeout), as it didn't consider that some of those
HTLCs may have already been claimed by a separate transaction.

This commit changes the behavior when handling preimage monitor updates
only. We will now only attempt to claim HTLCs for the specific preimage
that we learned via the monitor update. This is safe to do, as even if a
preimage HTLC claim transaction is reorged out, the `OnchainTxHandler`
is responsible for continuous claiming attempts until we see a reorg of
the corresponding commitment transaction.

Backport of 46f0d31

Conflicts resolved in:
 * lightning/src/chain/channelmonitor.rs

Silent conflicts resolved in:
 * lightning/src/ln/monitor_tests.rs
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 10, 2025

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

This reverts commit 3968d5e.

Not sure how this slipped in but it breaks semver (a new field in a
public struct) for a field that isn't used, so should be dropped.
@TheBlueMatt
Copy link
Collaborator Author

Oops, missed a word:

$ git diff-tree -U1 6528aa7c31 c5d06a622f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 595927d6a9..66d88ad9dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,3 +22,3 @@
    in the same MPP claim complete, and the node restarts twice, the preimage may
-   be lost and the MPP payment part may not claimed (#3928).
+   be lost and the MPP payment part may not be claimed (#3928).

Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 94.57831% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.50%. Comparing base (1e50365) to head (c5d06a6).
⚠️ Report is 6 commits behind head on 0.1.

Files with missing lines Patch % Lines
lightning/src/chain/channelmonitor.rs 92.59% 7 Missing and 1 partial ⚠️
lightning/src/ln/monitor_tests.rs 98.27% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              0.1    #4155      +/-   ##
==========================================
+ Coverage   87.48%   87.50%   +0.01%     
==========================================
  Files         149      149              
  Lines      101711   101834     +123     
  Branches   101711   101834     +123     
==========================================
+ Hits        88985    89106     +121     
  Misses      10466    10466              
- Partials     2260     2262       +2     

☔ 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.

/// Information about an HTLC that is part of a payment that can be claimed.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ClaimedHTLC {
/// The counterparty of the channel.
Copy link
Contributor

Choose a reason for hiding this comment

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

This commit seems like it should go earlier in the PR, probably doesn't matter though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mean the commit shouldn't have been backported at all, but oh well :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that was an oversight :( It's possible we should've broken up that backports PR, it was huge and there were some nontrivial backports.

I re-scanned and noticed the indexed_map's public API changed as well in that PR, though I doubt anyone uses that directly, I think that would also qualify as a semver violation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Its mostly a CI failure. We have a semver check CI job now, and it did fail here (which is why I noticed it). We should have checked it in the previous PR (and maybe should mark it required on the 0.1/0.2 branches).

Copy link
Contributor

@tankyleo tankyleo left a comment

Choose a reason for hiding this comment

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

Reviewed backport range-diff, reproduced git revert, proofread release notes and checked PR numbers.

@TheBlueMatt TheBlueMatt merged commit e48dc0e into lightningdevkit:0.1 Oct 10, 2025
20 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.

5 participants