Commit 946f2de
committed
Ack monitor events on revoke_and_ack
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 build on recent commits by ACK'ing monitor events for forward failures
once the monitor update that marks them as failed on the inbound edge is
complete, when the HTLC was irrevocably failed via revoke_and_ack.1 parent 49fc649 commit 946f2de
2 files changed
Lines changed: 20 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8601 | 8601 | | |
8602 | 8602 | | |
8603 | 8603 | | |
8604 | | - | |
| 8604 | + | |
8605 | 8605 | | |
8606 | 8606 | | |
8607 | 8607 | | |
| |||
8918 | 8918 | | |
8919 | 8919 | | |
8920 | 8920 | | |
| 8921 | + | |
8921 | 8922 | | |
8922 | 8923 | | |
8923 | 8924 | | |
| |||
8926 | 8927 | | |
8927 | 8928 | | |
8928 | 8929 | | |
8929 | | - | |
| 8930 | + | |
| 8931 | + | |
| 8932 | + | |
| 8933 | + | |
| 8934 | + | |
| 8935 | + | |
8930 | 8936 | | |
8931 | 8937 | | |
8932 | 8938 | | |
8933 | 8939 | | |
8934 | 8940 | | |
8935 | 8941 | | |
8936 | 8942 | | |
8937 | | - | |
8938 | | - | |
8939 | | - | |
8940 | | - | |
| 8943 | + | |
| 8944 | + | |
8941 | 8945 | | |
8942 | 8946 | | |
8943 | 8947 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12935 | 12935 | | |
12936 | 12936 | | |
12937 | 12937 | | |
12938 | | - | |
| 12938 | + | |
| 12939 | + | |
| 12940 | + | |
| 12941 | + | |
| 12942 | + | |
| 12943 | + | |
| 12944 | + | |
| 12945 | + | |
| 12946 | + | |
| 12947 | + | |
12939 | 12948 | | |
12940 | 12949 | | |
12941 | 12950 | | |
| |||
0 commit comments