Workaround lnd sending funding_locked before channel_reestablish 2021-06-workaround-broken-lnd
authorMatt Corallo <git@bluematt.me>
Wed, 23 Jun 2021 16:39:27 +0000 (16:39 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 28 Jun 2021 02:05:33 +0000 (02:05 +0000)
commit8df141233f03e6eefae75f3cf1183f00c1cc0aa9
tree7d4066befd70fcaefa3f16a54809d41b3946351e
parent073afbb24471a2e1bd50b88dc7a5e4d7cd4e0dd6
Workaround lnd sending funding_locked before channel_reestablish

lnd has a long-standing bug where, upon reconnection, if the
channel is not yet confirmed they will not send a
channel_reestablish until the channel locks in. Then, they will
send a funding_locked *before* sending the channel_reestablish
(which is clearly a violation of the BOLT specs). We copy
c-lightning's workaround here and simply store the funding_locked
message until we receive a channel_reestablish.

See-also https://github.com/lightningnetwork/lnd/issues/4006

Fixes #963
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs