Skip to content

Conversation

@wpaulino
Copy link
Contributor

@wpaulino wpaulino commented Dec 3, 2025

Previously, we'd emit a FundingTransactionReadyForSigning event once the initial commitment_signed is exchanged for a splicing/dual-funding attempt and require users to call back with their signed inputs using ChannelManager::funding_transaction_signed. While this approach worked in practice, it prevents us from abandoning a splice if we cannot or no longer wish to sign as the splice has already been committed to by this point.

This commit reworks the API such that this is now possible. After exchanging tx_complete, we will no longer immediately send our initial commitment_signed. We will now emit the
FundingTransactionReadyForSigning event and wait for the user to call back before releasing both our initial commitment_signed and our tx_signatures. As a result, the event is now persisted, as there is only one possible path in which it is generated. Note that we continue to only emit the event if a local contribution to negotiated transaction was made.

Future work will expose a cancellation API such that we can abandon splice attempts safely (we can just force close the channel with dual-funding).

@wpaulino wpaulino added this to the 0.3 milestone Dec 3, 2025
@wpaulino wpaulino requested a review from jkczyz December 3, 2025 18:47
@wpaulino wpaulino self-assigned this Dec 3, 2025
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Dec 3, 2025

👋 Thanks for assigning @jkczyz 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 wpaulino force-pushed the funding-transaction-signed-rework branch from 61719cf to 135605f Compare December 3, 2025 19:35
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 74.49664% with 76 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.60%. Comparing base (c5d7b13) to head (e502ce3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 81.32% 23 Missing and 8 partials ⚠️
lightning/src/ln/splicing_tests.rs 0.00% 23 Missing ⚠️
lightning/src/ln/channelmanager.rs 78.02% 18 Missing and 2 partials ⚠️
lightning/src/events/mod.rs 87.50% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4257      +/-   ##
==========================================
+ Coverage   86.59%   86.60%   +0.01%     
==========================================
  Files         158      158              
  Lines      102368   102376       +8     
  Branches   102368   102376       +8     
==========================================
+ Hits        88641    88659      +18     
+ Misses      11313    11297      -16     
- Partials     2414     2420       +6     
Flag Coverage Δ
fuzzing 36.99% <16.77%> (+0.05%) ⬆️
tests 85.89% <80.72%> (+0.01%) ⬆️

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 @jkczyz! 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.

@ldk-reviews-bot
Copy link

🔔 2nd Reminder

Hey @jkczyz! 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.

Comment on lines -6475 to -6640
Some(channel) => match channel.as_funded_mut() {
Some(chan) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, we can write a FundingTransactionReadyForSigning for dual funding, but upon restart the channel will be forgotten as it will still be considered pending. So calling funding_transaction_signed will fail in that case. Is this a problem? Or should we at least note this in the docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a note in the docs that it can happen

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

Comment on lines 2167 to 2168
// TODO(splicing): Support async signing
.ok_or("Failed to compute commitment_signed signatures".to_owned())?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ha, I thought you said this was supporting async signing :p

));
}
if channel.context().is_connected() {
if let Some(commit_sig) = commit_sig {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a test that checks that we avoid sending the commit sigs here if the funding_transaction_signed call comes in before the monitor is persisted (async)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can actually send our commit sig immediately after funding_transaction_signed, there's no reason to wait for the monitor persist to complete first. We just have to make sure we don't process a counterparty one before it completes.

Previously, we'd emit a `FundingTransactionReadyForSigning` event once
the initial `commitment_signed` is exchanged for a splicing/dual-funding
attempt and require users to call back with their signed inputs using
`ChannelManager::funding_transaction_signed`. While this approach worked
in practice, it prevents us from abandoning a splice if we cannot or no
longer wish to sign as the splice has already been committed to by this
point.

This commit reworks the API such that this is now possible. After
exchanging `tx_complete`, we will no longer immediately send our initial
`commitment_signed`. We will now emit the
`FundingTransactionReadyForSigning` event and wait for the user to call
back before releasing both our initial `commitment_signed` and our
`tx_signatures`. As a result, the event is now persisted, as there is
only one possible path in which it is generated. Note that we continue
to only emit the event if a local contribution to negotiated transaction
was made.

Future work will expose a cancellation API such that we can abandon
splice attempts safely (we can just force close the channel with
dual-funding).
We delay processing it until the user manually approves the splice via
`Channel::funding_transaction_signed`, as otherwise, there would be a
[`ChannelMonitorUpdateStep::RenegotiatedFunding`] committed that we
would need to undo if they no longer wish to proceed.

Note that this doesn't need to be done with dual-funded channels as
there is no equivalent monitor update for them.
@wpaulino wpaulino force-pushed the funding-transaction-signed-rework branch from 135605f to e502ce3 Compare January 14, 2026 22:20
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.

4 participants