Commit bbf1786
committed
Support persistent monitor events
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 complete work that was built on recent prior commits and actually start
re-providing monitor events on startup if they went un-acked during runtime.
This isn't actually supported in prod yet, so this new code will run randomly
in tests, to ensure we still support the old paths.1 parent 20ebcd3 commit bbf1786
File tree
4 files changed
+74
-9
lines changed- lightning/src
- chain
- ln
- util
4 files changed
+74
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1288 | 1288 | | |
1289 | 1289 | | |
1290 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
1291 | 1296 | | |
1292 | 1297 | | |
1293 | 1298 | | |
| |||
1765 | 1770 | | |
1766 | 1771 | | |
1767 | 1772 | | |
1768 | | - | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
1769 | 1779 | | |
1770 | 1780 | | |
1771 | 1781 | | |
| |||
1978 | 1988 | | |
1979 | 1989 | | |
1980 | 1990 | | |
| 1991 | + | |
1981 | 1992 | | |
1982 | 1993 | | |
1983 | 1994 | | |
| |||
2202 | 2213 | | |
2203 | 2214 | | |
2204 | 2215 | | |
2205 | | - | |
2206 | | - | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
2207 | 2225 | | |
2208 | 2226 | | |
2209 | 2227 | | |
2210 | 2228 | | |
2211 | 2229 | | |
2212 | 2230 | | |
2213 | 2231 | | |
2214 | | - | |
| 2232 | + | |
2215 | 2233 | | |
2216 | | - | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
2217 | 2239 | | |
2218 | 2240 | | |
| 2241 | + | |
2219 | 2242 | | |
2220 | 2243 | | |
2221 | 2244 | | |
| |||
4619 | 4642 | | |
4620 | 4643 | | |
4621 | 4644 | | |
4622 | | - | |
4623 | | - | |
4624 | | - | |
| 4645 | + | |
| 4646 | + | |
| 4647 | + | |
| 4648 | + | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
4625 | 4655 | | |
4626 | 4656 | | |
4627 | 4657 | | |
| |||
6971 | 7001 | | |
6972 | 7002 | | |
6973 | 7003 | | |
| 7004 | + | |
6974 | 7005 | | |
6975 | 7006 | | |
6976 | 7007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3641 | 3641 | | |
3642 | 3642 | | |
3643 | 3643 | | |
| 3644 | + | |
| 3645 | + | |
3644 | 3646 | | |
3645 | 3647 | | |
3646 | 3648 | | |
| |||
3697 | 3699 | | |
3698 | 3700 | | |
3699 | 3701 | | |
3700 | | - | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
| 3711 | + | |
| 3712 | + | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
3701 | 3723 | | |
3702 | 3724 | | |
3703 | 3725 | | |
| |||
11718 | 11740 | | |
11719 | 11741 | | |
11720 | 11742 | | |
| 11743 | + | |
11721 | 11744 | | |
11722 | 11745 | | |
11723 | 11746 | | |
| |||
11888 | 11911 | | |
11889 | 11912 | | |
11890 | 11913 | | |
| 11914 | + | |
11891 | 11915 | | |
11892 | 11916 | | |
11893 | 11917 | | |
| |||
12803 | 12827 | | |
12804 | 12828 | | |
12805 | 12829 | | |
| 12830 | + | |
12806 | 12831 | | |
12807 | 12832 | | |
12808 | 12833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3592 | 3592 | | |
3593 | 3593 | | |
3594 | 3594 | | |
| 3595 | + | |
| 3596 | + | |
| 3597 | + | |
3595 | 3598 | | |
3596 | 3599 | | |
3597 | 3600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1103 | 1103 | | |
1104 | 1104 | | |
1105 | 1105 | | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1106 | 1110 | | |
1107 | 1111 | | |
1108 | 1112 | | |
| |||
1119 | 1123 | | |
1120 | 1124 | | |
1121 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
1122 | 1128 | | |
1123 | 1129 | | |
1124 | 1130 | | |
| |||
0 commit comments