Commit f91c4fe
committed
Remove Completed from Watch trait, making updates always-async
The Watch trait previously shared ChannelMonitorUpdateStatus (with
Completed, InProgress, UnrecoverableError variants) with the Persist
trait. This meant ChannelManager had to handle both synchronous
completion and asynchronous completion, including a runtime check
(monitor_update_type atomic) to ensure they weren't mixed.
This commit makes the Watch trait always-async: watch_channel returns
Result<(), ()> and update_channel returns (). ChainMonitor maps
Persist::Completed onto an immediately-queued MonitorEvent::Completed
so the channel unblocks on the next event processing round. When
Persist returns Completed but prior async updates are still pending,
no event is emitted since the prior updates' eventual completion via
channel_monitor_updated will cover this update too.
This allows removing from ChannelManager:
- The WatchUpdateStatus enum (and former ChannelMonitorUpdateStatus
usage in Watch)
- The monitor_update_type atomic and its mode-mixing checks
- handle_monitor_update_res (was just a log, inlined)
- handle_post_close_monitor_update (trivial wrapper, inlined)
- handle_new_monitor_update_with_status (sync completion path)
AI tools were used in preparing this commit.1 parent ec03159 commit f91c4fe
File tree
5 files changed
+185
-442
lines changed- lightning/src
- chain
- ln
- util
5 files changed
+185
-442
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
1035 | | - | |
1036 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1037 | 1039 | | |
1038 | 1040 | | |
1039 | | - | |
| 1041 | + | |
1040 | 1042 | | |
1041 | 1043 | | |
1042 | 1044 | | |
| |||
1054 | 1056 | | |
1055 | 1057 | | |
1056 | 1058 | | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1057 | 1063 | | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1058 | 1071 | | |
1059 | | - | |
| 1072 | + | |
1060 | 1073 | | |
1061 | 1074 | | |
1062 | 1075 | | |
| |||
1271 | 1284 | | |
1272 | 1285 | | |
1273 | 1286 | | |
1274 | | - | |
| 1287 | + | |
1275 | 1288 | | |
1276 | 1289 | | |
1277 | 1290 | | |
| |||
1285 | 1298 | | |
1286 | 1299 | | |
1287 | 1300 | | |
1288 | | - | |
| 1301 | + | |
1289 | 1302 | | |
1290 | 1303 | | |
1291 | 1304 | | |
| 1305 | + | |
1292 | 1306 | | |
1293 | 1307 | | |
1294 | 1308 | | |
| 1309 | + | |
1295 | 1310 | | |
1296 | 1311 | | |
1297 | 1312 | | |
1298 | 1313 | | |
1299 | 1314 | | |
1300 | 1315 | | |
1301 | | - | |
| 1316 | + | |
1302 | 1317 | | |
1303 | 1318 | | |
1304 | 1319 | | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
1305 | 1323 | | |
1306 | 1324 | | |
1307 | 1325 | | |
1308 | 1326 | | |
1309 | | - | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1310 | 1344 | | |
1311 | 1345 | | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
| 1346 | + | |
1315 | 1347 | | |
1316 | 1348 | | |
1317 | 1349 | | |
| |||
1328 | 1360 | | |
1329 | 1361 | | |
1330 | 1362 | | |
1331 | | - | |
| 1363 | + | |
1332 | 1364 | | |
1333 | 1365 | | |
1334 | 1366 | | |
| |||
1382 | 1414 | | |
1383 | 1415 | | |
1384 | 1416 | | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
1385 | 1435 | | |
1386 | 1436 | | |
1387 | 1437 | | |
| |||
1413 | 1463 | | |
1414 | 1464 | | |
1415 | 1465 | | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
1421 | | - | |
1422 | 1466 | | |
1423 | 1467 | | |
1424 | 1468 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
| 297 | + | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| |||
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
315 | | - | |
| 316 | + | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | | - | |
321 | | - | |
| 321 | + | |
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
330 | 337 | | |
331 | 338 | | |
332 | | - | |
333 | | - | |
334 | | - | |
| 339 | + | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
341 | 346 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| |||
352 | 354 | | |
353 | 355 | | |
354 | 356 | | |
355 | | - | |
| 357 | + | |
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
359 | | - | |
360 | | - | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | | - | |
389 | | - | |
| 387 | + | |
| 388 | + | |
390 | 389 | | |
391 | 390 | | |
392 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9193 | 9193 | | |
9194 | 9194 | | |
9195 | 9195 | | |
9196 | | - | |
9197 | | - | |
9198 | 9196 | | |
9199 | 9197 | | |
9200 | 9198 | | |
| |||
0 commit comments