From a710922729844bea24d6b2b4635a931475d7b5a2 Mon Sep 17 00:00:00 2001 From: DerEwige Date: Mon, 16 Sep 2024 19:05:51 +0200 Subject: [PATCH] Ignore LND mutual close errors instead of force-closing (#2907) Older lnd nodes are unable to mutual close channels while HTLCs are in-flight. This triggers unexpected force-closes which can be costly for node operators. We ignore the errors coming from lnd that match this case to avoid that. --- .../scala/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala b/eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala index 31103a737b..bbd6a20182 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/ErrorHandlers.scala @@ -141,6 +141,13 @@ trait ErrorHandlers extends CommonHandlers { // it's up to them to broadcast their commitment if they wish. log.warning("ignoring remote 'internal error', probably coming from lnd") stay() sending Warning(d.channelId, "ignoring your 'internal error' to avoid an unnecessary force-close") + } else if (e.toAscii == "link failed to shutdown") { + // When trying to close a channel with LND older than version 0.18.0, + // LND will send an 'link failed to shutdown' error if there are HTLCs on the channel. + // Ignoring this error will prevent a force-close. + // The channel closing is retried on every reconnect of the channel, until it succeeds. + log.warning("ignoring remote 'link failed to shutdown', probably coming from lnd") + stay() sending Warning(d.channelId, "ignoring your 'link failed to shutdown' to avoid an unnecessary force-close") } else { spendLocalCurrent(hasCommitments) }