Commit 9becbbd
feat: accept stale channel monitors for recovery from monitor desync
When a channel monitor's update_id falls behind the ChannelManager
(e.g. after a migration overwrote newer data with stale backup data),
LDK refuses to start with DangerousValue. This adds a recovery path:
- Builder: new `set_accept_stale_channel_monitors(bool)` flag
- Build: passes flag to ChannelManagerReadArgs, which force-syncs
stale monitor update_ids instead of returning DangerousValue
- Startup: when flag is set, defers chain sync while sending probes
on all channels to trigger commitment round-trips that heal the
stale monitor state. Polls monitor update_ids with 60s timeout
and retries probes every 10s for late-connecting peers.
The probe-triggered commitment round-trip provides:
- LatestHolderCommitmentTXInfo (correct current commitment state)
- CommitmentSecret (recovers all gap revocation secrets via the
derivation tree)
Depends on: ben-kaufman/rust-lightning#fix/accept-stale-channel-monitors
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f045195 commit 9becbbd
4 files changed
Lines changed: 263 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
| |||
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
| 313 | + | |
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
| |||
361 | 363 | | |
362 | 364 | | |
363 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
364 | 379 | | |
365 | 380 | | |
366 | 381 | | |
| |||
813 | 828 | | |
814 | 829 | | |
815 | 830 | | |
| 831 | + | |
816 | 832 | | |
817 | 833 | | |
818 | 834 | | |
| |||
848 | 864 | | |
849 | 865 | | |
850 | 866 | | |
| 867 | + | |
851 | 868 | | |
852 | 869 | | |
853 | 870 | | |
| |||
917 | 934 | | |
918 | 935 | | |
919 | 936 | | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
920 | 944 | | |
921 | 945 | | |
922 | 946 | | |
| |||
1346 | 1370 | | |
1347 | 1371 | | |
1348 | 1372 | | |
1349 | | - | |
| 1373 | + | |
1350 | 1374 | | |
1351 | 1375 | | |
1352 | 1376 | | |
| |||
1876 | 1900 | | |
1877 | 1901 | | |
1878 | 1902 | | |
1879 | | - | |
| 1903 | + | |
1880 | 1904 | | |
1881 | 1905 | | |
1882 | 1906 | | |
| |||
1889 | 1913 | | |
1890 | 1914 | | |
1891 | 1915 | | |
| 1916 | + | |
1892 | 1917 | | |
1893 | 1918 | | |
1894 | 1919 | | |
| |||
2250 | 2275 | | |
2251 | 2276 | | |
2252 | 2277 | | |
| 2278 | + | |
2253 | 2279 | | |
2254 | 2280 | | |
2255 | 2281 | | |
| |||
0 commit comments