Skip to content

Integrate Splicing with Quiescence #4019

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

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

TheBlueMatt
Copy link
Collaborator

Based on #4007 this does the actual integration. Will probably go after #3979 so drafting for now.

In the case where we prepare to initiate quiescence, but cannot yet
send our `stfu` because we're waiting on some channel operations to
settle, and our peer ultimately sends their `stfu` before we can,
we would detect this case and, if we were able, send an `stfu`
which would allow us to send "something fundamental" first.

While this is a nifty optimization, its a bit overkill - the chance
that both us and our peer decide to attempt something fundamental
at the same time is pretty low, and worse this required additional
state tracking.

We simply remove this optimization here, simplifying the quiescence
state machine a good bit.
When we initiate quiescence, it should always be because we're
trying to accomplish something (in the short term only splicing).
In order to actually do that thing, we need to store the
instructions for that thing somewhere the splicing logic knows to
look at once we reach quiescence.

Here we add a simple enum which will eventually store such actions.
There are a number of things in LDK where we've been lazy and not
allowed the user to initiate an action while a peer is
disconnected. While it may be accurate in the sense that the action
cannot be started while the peer is disconnected, it is terrible
dev UX - these actions can fail without the developer being at
fault and the only way for them to address it is just try again.

Here we fix this dev UX shortcoming for splicing, keeping any
queued post-quiescent actions around when a peer disconnects and
retrying the action (and quiescence generally) when the peer
reconnects.
Now that we have a `QuiescentAction` to track what we intend to do
once we reach quiescence, we need to use it to initiate splices.

Here we do so, adding a new `SpliceInstructions` to track the
arguments that are currently passed to `splice_channel`. While
these may not be exactly the right arguments to track in the end,
a lot of the splice logic is still in flight, so we can worry about
it later.
While we have a test to disconnect a peer if we're waiting on an
`stfu` message, we also disconnect if we've reached quiescence but
we're waiting on a peer to do "something fundamental" and they take
too long to do so. We test that behavior here.
Copy link

codecov bot commented Aug 18, 2025

Codecov Report

❌ Patch coverage is 83.14607% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.82%. Comparing base (6a4169d) to head (be3b93a).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 18.75% 13 Missing ⚠️
lightning/src/ln/channel.rs 78.43% 8 Missing and 3 partials ⚠️
lightning/src/ln/quiescence_tests.rs 94.59% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4019      +/-   ##
==========================================
- Coverage   88.90%   88.82%   -0.08%     
==========================================
  Files         174      175       +1     
  Lines      125114   127848    +2734     
  Branches   125114   127848    +2734     
==========================================
+ Hits       111234   113563    +2329     
- Misses      11364    11717     +353     
- Partials     2516     2568      +52     
Flag Coverage Δ
fuzzing 21.75% <13.43%> (-0.38%) ⬇️
tests 88.65% <83.14%> (-0.08%) ⬇️

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.

1 participant