Unset `Channel::is_usable` if mon update is blocking funding_locked
authorMatt Corallo <git@bluematt.me>
Thu, 18 Nov 2021 21:54:10 +0000 (21:54 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 26 Jan 2022 18:20:26 +0000 (18:20 +0000)
commite7facb1b66a7b3bfdd3dedd41739dcedd8de4b11
tree2df2f6dd81cf6fa3a1249379d03c961bb38bbede
parent0243f2116099d7be9e9f3bdeee670273cd27082c
Unset `Channel::is_usable` if mon update is blocking funding_locked

If we have not yet sent `funding_locked` only because of a pending
channel monitor update, we shouldn't consider a channel
`is_usable`. This has a number of downstream effects, including
not attempting to route payments through the channel, not sending
private `channel_update` messages to our counterparty, or sending
channel_announcement messages if our couterparty has already signed
for it.

We further gate generation of `node_announcement`s on `is_usable`,
preventing generation of those or `announcement_signatures` until
we've sent our `funding_locked`.

Finally, `during_funding_monitor_fail` is updated to test a case
where we see the funding transaction lock in but have a pending
monitor update failure, then receive `funding_locked` from our
counterparty and ensure we don't generate the above messages until
after the monitor update completes.
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channel.rs