Commit 79be78c
Move ChannelMonitorUpdateStatus mode check from ChannelManager to ChainMonitor
When `ChannelMonitor::update_monitor` fails (e.g. a counterparty
`commitment_signed` arrives after funding was spent), `ChainMonitor`
persists the full monitor successfully but overrides the return value
to `InProgress`. If the user's `Persist` impl only returns `Completed`,
this causes `ChannelManager::handle_monitor_update_res` to panic on
the mode mismatch.
The root cause is that the mode check lived in `ChannelManager`, which
sees the *post-override* status. By moving the check to `ChainMonitor`
and running it against the *raw* `Persist` result (before the
`update_res.is_err()` override), we validate only the user's persister
behavior. ChainMonitor's internal override to `InProgress` for failed
monitor updates no longer triggers a false mode violation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2d2151a commit 79be78c
2 files changed
Lines changed: 34 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
372 | 378 | | |
373 | 379 | | |
374 | 380 | | |
| |||
412 | 418 | | |
413 | 419 | | |
414 | 420 | | |
| 421 | + | |
| 422 | + | |
415 | 423 | | |
416 | 424 | | |
417 | 425 | | |
| |||
617 | 625 | | |
618 | 626 | | |
619 | 627 | | |
| 628 | + | |
| 629 | + | |
620 | 630 | | |
621 | 631 | | |
622 | 632 | | |
623 | 633 | | |
624 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
625 | 654 | | |
626 | 655 | | |
627 | 656 | | |
| |||
1285 | 1314 | | |
1286 | 1315 | | |
1287 | 1316 | | |
| 1317 | + | |
| 1318 | + | |
1288 | 1319 | | |
1289 | 1320 | | |
1290 | 1321 | | |
| |||
1367 | 1398 | | |
1368 | 1399 | | |
1369 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
1370 | 1403 | | |
1371 | 1404 | | |
1372 | 1405 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2779 | 2779 | | |
2780 | 2780 | | |
2781 | 2781 | | |
2782 | | - | |
2783 | | - | |
2784 | | - | |
2785 | | - | |
2786 | | - | |
2787 | | - | |
2788 | | - | |
2789 | 2782 | | |
2790 | 2783 | | |
2791 | 2784 | | |
| |||
3527 | 3520 | | |
3528 | 3521 | | |
3529 | 3522 | | |
3530 | | - | |
3531 | | - | |
3532 | | - | |
3533 | 3523 | | |
3534 | 3524 | | |
3535 | 3525 | | |
| |||
10006 | 9996 | | |
10007 | 9997 | | |
10008 | 9998 | | |
10009 | | - | |
10010 | | - | |
10011 | | - | |
10012 | | - | |
10013 | 9999 | | |
10014 | 10000 | | |
10015 | 10001 | | |
10016 | 10002 | | |
10017 | 10003 | | |
10018 | 10004 | | |
10019 | | - | |
10020 | | - | |
10021 | | - | |
10022 | | - | |
10023 | | - | |
10024 | | - | |
10025 | | - | |
| 10005 | + | |
10026 | 10006 | | |
10027 | 10007 | | |
10028 | 10008 | | |
| |||
19550 | 19530 | | |
19551 | 19531 | | |
19552 | 19532 | | |
19553 | | - | |
19554 | | - | |
19555 | | - | |
19556 | 19533 | | |
19557 | 19534 | | |
19558 | 19535 | | |
| |||
0 commit comments