Skip to content

Broadcast holder commitment for currently confirmed funding #3939

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 4 commits into
base: main
Choose a base branch
from

Conversation

wpaulino
Copy link
Contributor

A splice's FundingScope can only be promoted once a ChannelMonitorUpdateStep::RenegotiatedFundingLocked is applied, or if the monitor is no longer accepting updates, once the splice 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 propagate throughout the network.

Depends on #3894.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jul 17, 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.

wpaulino added 4 commits July 18, 2025 15:19
This is a new `ChannelMonitorUpdateStep` variant intended to be used
whenever a new funding transaction that was negotiated and applied via
the `RenegotiatedFunding` update reaches its intended confirmation depth
and both sides of the channel exchange `channel_ready`/`splice_locked`.
This commit primarily focuses on its use for splices, but future work
will expand where needed to support RBFs for a dual funded channel.

This monitor update ensures that the monitor can safely drop all prior
commitment data since it is now considered invalid/unnecessary. Once the
update is applied, only state for the new funding transaction is tracked
going forward, until the monitor receives another `RenegotiatedFunding`
update.
It's only intended to be set during initialization and used to check if
the channel is v1 or v2. We rename it to `first_negotiated_funding_txo`
to better reflect its purpose.
A `ChannelMonitor` will always consider a channel closed once a
confirmed spend for the funding transaction is detected. This is no
longer the case with splicing, as the channel will remain open and
capable of accepting updates while its funding transaction is being
replaced.
A splice's `FundingScope` can only be promoted once a
`ChannelMonitorUpdateStep::RenegotiatedFundingLocked` is applied, or if
the monitor is no longer accepting updates, once the splice 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.
@wpaulino wpaulino force-pushed the splice-funding-commitment-broadcast branch from a783444 to a8ae4b7 Compare July 18, 2025 22:23
@wpaulino wpaulino requested a review from TheBlueMatt July 18, 2025 22:23
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

Attention: Patch coverage is 52.14521% with 145 lines in your changes missing coverage. Please review.

Project coverage is 88.92%. Comparing base (eae2bb1) to head (a8ae4b7).
Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/chain/channelmonitor.rs 42.12% 120 Missing and 16 partials ⚠️
lightning/src/chain/onchaintx.rs 69.56% 6 Missing and 1 partial ⚠️
lightning/src/ln/channelmanager.rs 93.54% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3939      +/-   ##
==========================================
- Coverage   89.02%   88.92%   -0.10%     
==========================================
  Files         166      167       +1     
  Lines      121374   121985     +611     
  Branches   121374   121985     +611     
==========================================
+ Hits       108049   108475     +426     
- Misses      10927    11077     +150     
- Partials     2398     2433      +35     
Flag Coverage Δ
fuzz 22.67% <23.43%> (+0.09%) ⬆️

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.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @TheBlueMatt! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants