Skip to content

Consider currently confirmed FundingScope when claiming commitments #3980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wpaulino
Copy link
Contributor

Once a commitment transaction confirms, we may have outputs to claim. To determine whom the commitment transaction belongs to, we generally compare its txid against what we know be ours and the counterparty's. This, however, relies on being able to match on the expected FundingScope, such that we can produce the necessary output claims. Since a commitment transaction confirming implies that the funding transaction it spends has also confirmed, we rely on alternative_funding_confirmed to obtain the corresponding FundingScope.

Depends on #3939.

wpaulino added 3 commits July 31, 2025 09:30
Whether it's a splice, or a dual-funded RBF, we need to know which
funding transaction out of all of the negotiated ones is currently
confirmed in case we need to broadcast the holder commitment.
A `FundingScope` can only be promoted once a
`ChannelMonitorUpdateStep::RenegotiatedFundingLocked` is applied, or if
the monitor is no longer accepting updates, once the renegotiated
funding transaction is no longer under reorg risk. Because of this, our
current `FundingScope` may not reflect the latest confirmed state in the
chain. Before making a holder commitment broadcast, we must check which
`FundingScope` is currently confirmed to ensure that it can propogate
throughout the network.
Once a commitment transaction confirms, we may have outputs to claim. To
determine whom the commitment transaction belongs to, we generally
compare its `txid` against what we know be ours and the counterparty's.
This, however, relies on being able to match on the expected
`FundingScope`, such that we can produce the necessary output claims.
Since a commitment transaction confirming implies that the funding
transaction it spends has also confirmed, we rely on
`alternative_funding_confirmed` to obtain the corresponding
`FundingScope`.
@wpaulino wpaulino requested a review from TheBlueMatt July 31, 2025 18:20
@wpaulino wpaulino self-assigned this Jul 31, 2025
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jul 31, 2025

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

Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 57.18391% with 149 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.79%. Comparing base (ecce268) to head (5ecc866).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/chain/channelmonitor.rs 55.55% 128 Missing and 20 partials ⚠️
lightning/src/chain/onchaintx.rs 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3980      +/-   ##
==========================================
- Coverage   88.93%   88.79%   -0.14%     
==========================================
  Files         174      174              
  Lines      123842   124445     +603     
  Branches   123842   124445     +603     
==========================================
+ Hits       110142   110507     +365     
- Misses      11254    11437     +183     
- Partials     2446     2501      +55     
Flag Coverage Δ
fuzzing 22.59% <29.02%> (-0.02%) ⬇️
tests 88.62% <57.18%> (-0.14%) ⬇️

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.

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.

2 participants