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

Handle shutdown retransmit when negotiating (#1902)

We didn't handle shutdown messages in the negotiating state, whereas they
may be received upon reconnection. This created some unnecessary warnings
in the logs.
This commit is contained in:
Bastien Teinturier 2021-08-16 10:18:54 +02:00 committed by GitHub
parent 9f2b0368c7
commit 4cde8c555f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1251,6 +1251,14 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
})
when(NEGOTIATING)(handleExceptions {
// Upon reconnection, nodes must re-transmit their shutdown message, so we may receive it now.
case Event(remoteShutdown: Shutdown, d: DATA_NEGOTIATING) =>
if (remoteShutdown != d.remoteShutdown) {
// This is a spec violation: it will likely lead to a disagreement when exchanging closing_signed and a force-close.
log.warning("received unexpected shutdown={} (previous={})", remoteShutdown, d.remoteShutdown)
}
stay()
case Event(c@ClosingSigned(_, remoteClosingFee, remoteSig), d: DATA_NEGOTIATING) =>
log.info("received closingFeeSatoshis={}", remoteClosingFee)
Closing.checkClosingSignature(keyManager, d.commitments, d.localShutdown.scriptPubKey, d.remoteShutdown.scriptPubKey, remoteClosingFee, remoteSig) match {