Commit 550df93
committed
Fix replay of monitor events for outbounds
Currently, the resolution of HTLCs (and decisions on when HTLCs can be
forwarded) is the responsibility of Channel objects (a part of ChannelManager)
until the channel is closed, and then the ChannelMonitor thereafter. This leads
to some complexity around race conditions for HTLCs right around channel
closure. Additionally, there is lots of complexity reconstructing the state of
all HTLCs in the ChannelManager deserialization/loading logic.
Instead, we want to do all resolution in ChannelMonitors (in response to
ChannelMonitorUpdates) and pass them back to ChannelManager in the form of
MonitorEvents (similar to how HTLCs are resolved after channels are closed). In
order to have reliable resolution, we'll need to keep MonitorEvents around in
the ChannelMonitor until the ChannelManager has finished processing them. This
will simplify things - on restart instead of examining the set of HTLCs in
monitors we can simply replay all the pending MonitorEvents.
If an outbound payment resolved on-chain and we get a monitor event for it, we
want to mark that monitor event as resolved once the user has processed a
PaymentSent or a PaymentFailed event.1 parent 8972f05 commit 550df93
1 file changed
Lines changed: 29 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1544 | 1544 | | |
1545 | 1545 | | |
1546 | 1546 | | |
1547 | | - | |
| 1547 | + | |
1548 | 1548 | | |
1549 | 1549 | | |
1550 | 1550 | | |
1551 | 1551 | | |
1552 | 1552 | | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
1553 | 1567 | | |
1554 | 1568 | | |
1555 | 1569 | | |
1556 | 1570 | | |
1557 | 1571 | | |
1558 | 1572 | | |
1559 | 1573 | | |
| 1574 | + | |
1560 | 1575 | | |
1561 | 1576 | | |
1562 | 1577 | | |
| |||
9871 | 9886 | | |
9872 | 9887 | | |
9873 | 9888 | | |
| 9889 | + | |
9874 | 9890 | | |
9875 | 9891 | | |
9876 | 9892 | | |
| |||
9889 | 9905 | | |
9890 | 9906 | | |
9891 | 9907 | | |
| 9908 | + | |
9892 | 9909 | | |
9893 | 9910 | | |
9894 | 9911 | | |
| |||
12474 | 12491 | | |
12475 | 12492 | | |
12476 | 12493 | | |
| 12494 | + | |
12477 | 12495 | | |
12478 | 12496 | | |
12479 | 12497 | | |
| |||
13297 | 13315 | | |
13298 | 13316 | | |
13299 | 13317 | | |
| 13318 | + | |
13300 | 13319 | | |
13301 | 13320 | | |
13302 | 13321 | | |
| |||
13309 | 13328 | | |
13310 | 13329 | | |
13311 | 13330 | | |
| 13331 | + | |
13312 | 13332 | | |
13313 | 13333 | | |
13314 | 13334 | | |
| |||
15086 | 15106 | | |
15087 | 15107 | | |
15088 | 15108 | | |
| 15109 | + | |
15089 | 15110 | | |
15090 | 15111 | | |
| 15112 | + | |
| 15113 | + | |
| 15114 | + | |
| 15115 | + | |
15091 | 15116 | | |
15092 | 15117 | | |
15093 | 15118 | | |
| |||
19460 | 19485 | | |
19461 | 19486 | | |
19462 | 19487 | | |
| 19488 | + | |
19463 | 19489 | | |
19464 | 19490 | | |
19465 | 19491 | | |
| |||
19539 | 19565 | | |
19540 | 19566 | | |
19541 | 19567 | | |
| 19568 | + | |
19542 | 19569 | | |
19543 | 19570 | | |
19544 | 19571 | | |
| |||
20296 | 20323 | | |
20297 | 20324 | | |
20298 | 20325 | | |
| 20326 | + | |
20299 | 20327 | | |
20300 | 20328 | | |
20301 | 20329 | | |
| |||
0 commit comments