1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-24 22:58:23 +01:00

Add workaround for lnd sync issue (#1563)

When a channel gets confirmed while nodes are disconnected, recent lnd
nodes sometimes fail to send their channel_reestablish message and instead
send a funding_locked first (due to a race condition on their side).

When that happened, the channel stayed stuck in the SYNCING state.
To avoid that, we trigger a reconnection until the race condition is eventually
won by the channel_reestablish.
This commit is contained in:
Bastien Teinturier 2020-10-14 13:22:37 +02:00 committed by GitHub
parent f9ff586cba
commit 131b2e01c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1598,6 +1598,15 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
goto(NEGOTIATING) using d.copy(closingTxProposed = closingTxProposed1) sending d.localShutdown goto(NEGOTIATING) using d.copy(closingTxProposed = closingTxProposed1) sending d.localShutdown
} }
// This handler is a workaround for an issue in lnd: starting with versions 0.10 / 0.11, they sometimes fail to send
// a channel_reestablish when reconnecting a channel that recently got confirmed, and instead send a funding_locked
// first and then go silent. This is due to a race condition on their side, so we trigger a reconnection, hoping that
// we will eventually receive their channel_reestablish.
case Event(_: FundingLocked, _) =>
log.warning("received funding_locked before channel_reestablish (known lnd bug): disconnecting...")
peer ! Peer.Disconnect(remoteNodeId)
stay
case Event(c: CurrentBlockCount, d: HasCommitments) => handleNewBlock(c, d) case Event(c: CurrentBlockCount, d: HasCommitments) => handleNewBlock(c, d)
case Event(c: CurrentFeerates, d: HasCommitments) => case Event(c: CurrentFeerates, d: HasCommitments) =>