Consider channels "live" even if they are awaiting a monitor update 2021-06-no-spurious-forward-fails
authorMatt Corallo <git@bluematt.me>
Wed, 16 Jun 2021 22:57:38 +0000 (22:57 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 30 Jun 2021 23:15:22 +0000 (23:15 +0000)
commitb58c88430e9229b5b4a58aa87f4c14aca739b0da
treeedd729c3a33cc44614796a370f02992dd7d9d50c
parent294009969aef617df4184ff41ef6daa5a445f213
Consider channels "live" even if they are awaiting a monitor update

We use `Channel::is_live()` to gate inclusion of a channel in
`ChannelManager::list_usable_channels()` and when sending an
HTLC to select whether a channel is available for
forwarding through/sending to.

In both of these cases, we should consider a channel `is_live()` when
they are pending a monitor update. Some clients may update monitors
asynchronously, thus we may simply be waiting a short duration for a
monitor update to complete, and shouldn't fail all forwarding HTLCs
during that time.

After #851, we always ensure any holding cells are free'd when
sending P2P messages, making this change much more trivially
correct - instead of having to ensure that we always free the holding
cell when a channel becomes live again after adding something to the
holding cell, we can simply rely on the fact that it always happens.

Fixes #661.
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs