Add upgrade test for legacy post-close monitor update persistence#4755
Add upgrade test for legacy post-close monitor update persistence#4755GideonBature wants to merge 1 commit into
Conversation
|
I've assigned @wpaulino as a reviewer! |
|
I reviewed the entire diff and cross-checked the test against the implementation it exercises. No issues found. The test correctly exercises both legacy-handling paths:
Verified: field visibility ( |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4755 +/- ##
=======================================
Coverage 86.96% 86.97%
=======================================
Files 161 161
Lines 111648 111715 +67
Branches 111648 111715 +67
=======================================
+ Hits 97099 97160 +61
- Misses 12045 12050 +5
- Partials 2504 2505 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LDK prior to 0.1 used
u64::MAX(LEGACY_CLOSED_CHANNEL_UPDATE_ID) as theupdate_idfor anyChannelMonitorUpdategenerated after a channel had been closed. Since the change to stop using a constant monitorupdate_idafter closure, we no longer generate these updates. However, bothChannelMonitor::update_monitorandMonitorUpdatingPersisterstill need to handle them so that nodes upgrading from pre-0.1 versions continue to work correctly.This adds
legacy_closed_channel_update, which synthesizes a pre-0.1 on-disk artifact: aChannelForceClosedupdate withupdate_id == u64::MAX. The test exercises both directions of the legacy handling:Read path: The update is written directly to the KV store as a standalone update file named by the sentinel ID, matching what a pre-0.1 persister may have left behind. When the monitor is read back, it must discover and replay the update, leaving the monitor at
update_id == u64::MAX.Write path: Passing the persister a sentinel-ID update must result in a full monitor write instead of a standalone update file. It must also purge stale update files through the legacy cleanup branch.
Closes #4104