Attempt to unblock blocked monitor updates on startup#4520
Conversation
|
👋 I see @tankyleo was un-assigned. |
|
There was a unit test already in issue linked in the description. On branch main...joostjager:2026-03-startup-mpp-unblock-with-test, it's added as a commit, and shows that your fix makes the test pass. |
|
Discussed offline and improved unit test by ignoring some ignored read outs and 'loops until settled'. |
When we make an MPP claim we push RAA blockers for each chanel to ensure we don't allow any single channel to make too much progress until all channels have the preimage durably on disk. We don't have to store those RAA blockers on disk in the ChannelManager as there's no point - if the ChannelManager gets to disk with the RAA blockers it also brought with it the pending ChannelMonitorUpdates that contain the preimages and will now be replayed, ensuring the preimage makes it to all ChannelMonitors. However, just because those RAA blockers dissapear on reload doesn't mean the implications of them does too - if a later ChannelMonitorUpdate was blocked in the channel we don't have logic to unblock it on startup. Here we add such logic, simply attempting to unblock all blocked `ChannelMonitorUpdate`s that existed on startup. Code written by Claude. Fixes lightningdevkit#4518
a38acca to
6977e25
Compare
|
Thanks! Rebased and included the test. |
|
Good — takes I've done a thorough review of the implementation and test. My prior review was correct — no issues found. No issues found. The implementation is correct:
|
6977e25 to
52a0030
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4520 +/- ##
==========================================
- Coverage 86.16% 86.14% -0.03%
==========================================
Files 156 157 +1
Lines 108669 108958 +289
Branches 108669 108958 +289
==========================================
+ Hits 93638 93857 +219
- Misses 12420 12484 +64
- Partials 2611 2617 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
joostjager
left a comment
There was a problem hiding this comment.
Even though the fix is just a few lines, it is still hard to fully understand all the consequences. Buthandle_monitor_update_release called with None seems safe with its double-check, and it fixes the bug.
| } | ||
|
|
||
| #[test] | ||
| fn test_mpp_claim_htlc_fulfills_unblocked_on_reload() { |
There was a problem hiding this comment.
I think you picked the commit message from the first commit on my branch where the test was bug-reproducing ("verifies the bug leaves an htlc stuck"), and combined it with the final test.
There was a problem hiding this comment.
Oops, tweaked the commit message. Looks like we didn't get a second reviewer on this so hit the button.
|
👋 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. |
|
Additional verification of this PR: #4601 |
|
✅ Added second reviewer: @tankyleo |
Add a characterization test for a claimed MPP payment whose preimage monitor updates are only partially persisted before restart. The test drives both channels through a held fee-update commitment dance, claims with async monitor persistence, reloads one fresh and one stale monitor, and verifies that we don't leave a sender-side HTLC stuck after reconnect.
52a0030 to
01d55dc
Compare
When we make an MPP claim we push RAA blockers for each chanel to ensure we don't allow any single channel to make too much progress until all channels have the preimage durably on disk. We don't have to store those RAA blockers on disk in the ChannelManager as there's no point - if the ChannelManager gets to disk with the RAA blockers it also brought with it the pending ChannelMonitorUpdates that contain the preimages and will now be replayed, ensuring the preimage makes it to all ChannelMonitors.
However, just because those RAA blockers dissapear on reload doesn't mean the implications of them does too - if a later ChannelMonitorUpdate was blocked in the channel we don't have logic to unblock it on startup.
Here we add such logic, simply attempting to unblock all blocked
ChannelMonitorUpdates that existed on startup.Code written by Claude.
Fixes #4518
Needs a test, I have a start on one but need to clean it up