Commit 5de2515
committed
Add MonitorUpdateCompletionAction::AckMonitorEvents
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.
Here we add a MonitorUpdateCompletionAction that will allow the ChannelManager
to tell a monitor that an event is complete, upon completion of a particular
ChannelMonitorUpdate. For example, this will be used when an HTLC is
irrevocably failed backwards post-channel-close, to delete the corresponding
MonitorEvent::HTLCEvent.1 parent cfc185c commit 5de2515
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
1492 | 1493 | | |
1493 | 1494 | | |
1494 | 1495 | | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
1495 | 1499 | | |
1496 | 1500 | | |
1497 | 1501 | | |
| |||
1513 | 1517 | | |
1514 | 1518 | | |
1515 | 1519 | | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
1516 | 1523 | | |
1517 | 1524 | | |
1518 | 1525 | | |
| |||
10252 | 10259 | | |
10253 | 10260 | | |
10254 | 10261 | | |
| 10262 | + | |
| 10263 | + | |
| 10264 | + | |
| 10265 | + | |
| 10266 | + | |
10255 | 10267 | | |
10256 | 10268 | | |
10257 | 10269 | | |
| |||
0 commit comments