lightningd: close connection when HTLC addition times out.

I noticed this while debugging an issue with ACINQ, that we got upset,
but didn't trigger a reconnect cycle.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: Protocol: We now close connection with a peer if adding an HTLC times out (which may be a TCP connectivity issue).
This commit is contained in:
Rusty Russell 2023-08-07 13:11:50 +09:30
parent d4ed1c7f6f
commit 91ea85be36
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include <common/onionreply.h>
#include <common/timeout.h>
#include <common/type_to_string.h>
#include <connectd/connectd_wiregen.h>
#include <db/exec.h>
#include <gossipd/gossipd_wiregen.h>
#include <lightningd/chaintopology.h>
@ -591,6 +592,14 @@ static void htlc_offer_timeout(struct htlc_out *out)
tal_free(channel->owner);
channel_set_billboard(channel, false,
"Adding HTLC timed out: killed connection");
/* Force a disconnect in case the issue is with TCP */
if (channel->peer->ld->connectd) {
const struct peer *peer = channel->peer;
subd_send_msg(peer->ld->connectd,
take(towire_connectd_discard_peer(NULL, &peer->id,
peer->connectd_counter)));
}
}
/* Returns failmsg, or NULL on success. */

View File

@ -3641,7 +3641,6 @@ def test_close_weight_estimate(node_factory, bitcoind):
assert signed_weight + 6 >= final_estimate # 70byte signature
@pytest.mark.xfail(strict=True)
@pytest.mark.developer("needs dev_disconnect")
def test_onchain_close_upstream(node_factory, bitcoind):
"""https://github.com/ElementsProject/lightning/issues/4649