Allow holding `ChannelMonitorUpdate`s until later, completing one
authorMatt Corallo <git@bluematt.me>
Wed, 15 Mar 2023 23:16:06 +0000 (23:16 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 2 May 2023 17:59:22 +0000 (17:59 +0000)
commitac5efa275539c5b7cd89665e6b5d9f2afaf8f945
tree413ce2f43cbf66a96156769216a10fe6b7c9dca1
parent88c63e9dbb676d42dfa6ee2318e4535af83b31e3
Allow holding `ChannelMonitorUpdate`s until later, completing one

In the coming commits, we need to delay `ChannelMonitorUpdate`s
until future actions (specifically `Event` handling). However,
because we should only notify users once of a given
`ChannelMonitorUpdate` and they must be provided in-order, we need
to track which ones have or have not been given to users and, once
updating resumes, fly the ones that haven't already made it to
users.

To do this we simply add a `bool` in the `ChannelMonitorUpdate` set
stored in the `Channel` which indicates if an update flew and
decline to provide new updates back to the `ChannelManager` if any
updates have their flown bit unset.

Further, because we'll now by releasing `ChannelMonitorUpdate`s
which were already stored in the pending list, we now need to
support getting a `Completed` result for a monitor which isn't the
only pending monitor (or even out of order), thus we also rewrite
the way monitor updates are marked completed.
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs