Commit dd21fce
committed
Correctly handle new
In 0.1 (1481216) we started
setting `ChannelMonitorUpdate::update_id` to a non-`u64::MAX` value
for updates generated after a channel has been closed.
This is great, but in 71a364c we
then started calculating the next `update_id` by incrementing the
last `update_id` we saw when we started and were looking at the
`ChannelMonitor`. However, the last-applied `update_id` may well be
`u64::MAX` for old `ChannelMonitor`s which were closed prior to
0.1. In that case the increment would overflow.
Here we fix this naively by simply replacing the increment with a
`saturating_add`. While its possible this will result in a
`ChannelMonitorUpdate` being tracked as in-flight (only for the
`ReleasePaymentComplete` updates added in 71a364c)
at the same `update_id` as other updates already in-flight and
handling post-`ChannelMonitorUpdate` actions too early, this should
only apply to releasing payment complete updates, which have no
post-`ChannelMonitorUpdate` action.
Its also possible that this leads to a regression in the future,
where we have some new post-closure update that does have a
post-`ChannelMonitorUpdate` action and we run it too early, but by
then presumably its fairly rare to have a `ChannelMonitor` for a
channel closed pre-0.1 that still needs multiple updates.ChannelMonitorUpdates to old post-FC chans1 parent 54ed941 commit dd21fce
1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1601 | 1601 | | |
1602 | 1602 | | |
1603 | 1603 | | |
| 1604 | + | |
| 1605 | + | |
1604 | 1606 | | |
1605 | 1607 | | |
1606 | 1608 | | |
| |||
13262 | 13264 | | |
13263 | 13265 | | |
13264 | 13266 | | |
13265 | | - | |
| 13267 | + | |
| 13268 | + | |
13266 | 13269 | | |
13267 | 13270 | | |
13268 | 13271 | | |
| |||
16523 | 16526 | | |
16524 | 16527 | | |
16525 | 16528 | | |
16526 | | - | |
| 16529 | + | |
| 16530 | + | |
| 16531 | + | |
16527 | 16532 | | |
16528 | 16533 | | |
16529 | 16534 | | |
| |||
17170 | 17175 | | |
17171 | 17176 | | |
17172 | 17177 | | |
17173 | | - | |
| 17178 | + | |
| 17179 | + | |
| 17180 | + | |
17174 | 17181 | | |
17175 | 17182 | | |
17176 | 17183 | | |
| |||
0 commit comments