Disconnect peers on timer ticks to unblock channel state machine
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Sat, 13 May 2023 01:39:18 +0000 (18:39 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Fri, 26 May 2023 21:40:19 +0000 (14:40 -0700)
commit5bf7fac69facf0c59ec0f09f130ed015d3f43436
treefa3340375aea8b676c5762bfea3a5bd39ee72ab4
parent5ba2f8091f06f696d62d94c70a339f14300dbbda
Disconnect peers on timer ticks to unblock channel state machine

At times, we've noticed that channels with `lnd` counterparties do not
receive messages we expect to in a timely manner (or at all) after
sending them a `ChannelReestablish` upon reconnection, or a
`CommitmentSigned` message. This can block the channel state machine
from making progress, eventually leading to force closes, if any pending
HTLCs are committed and their expiration is met.

It seems common wisdom for `lnd` node operators to periodically restart
their node/reconnect to their peers, allowing them to start from a fresh
state such that the message we expect to receive hopefully gets sent. We
can achieve the same end result by disconnecting peers ourselves
(regardless of whether they're a `lnd` node), which we opt to implement
here by awaiting their response within two timer ticks.
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs