1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-20 02:27:32 +01:00

Watch future remote commit on restore (#766)

We need to put back watches on restart in "future remote commit published" scenarii, otherwise we will never consider the channel closed if we restart before the "claim main output" tx is confirmed. Note that there was no risk of losing funds, but the channel would have lingered forever.
This commit is contained in:
Pierre-Marie Padiou 2018-11-23 16:38:07 +01:00 committed by GitHub
parent fa1b2e4c00
commit 1c0e24a909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,8 @@ class Channel(val nodeParams: NodeParams, wallet: EclairWallet, remoteNodeId: Pu
if (closing.localCommitPublished.exists(_.irrevocablySpent.contains(commitTxOutpoint)) ||
closing.remoteCommitPublished.exists(_.irrevocablySpent.contains(commitTxOutpoint)) ||
closing.nextRemoteCommitPublished.exists(_.irrevocablySpent.contains(commitTxOutpoint)) ||
closing.revokedCommitPublished.exists(_.irrevocablySpent.contains(commitTxOutpoint))) {
closing.revokedCommitPublished.exists(_.irrevocablySpent.contains(commitTxOutpoint)) ||
closing.futureRemoteCommitPublished.exists(_.irrevocablySpent.contains(commitTxOutpoint))) {
log.info(s"funding tx has already been spent and spending tx reached mindepth, no need to put back the watch-spent")
} else {
// TODO: should we wait for an acknowledgment from the watcher?
@ -176,6 +177,7 @@ class Channel(val nodeParams: NodeParams, wallet: EclairWallet, remoteNodeId: Pu
closing.remoteCommitPublished.foreach(doPublish(_))
closing.nextRemoteCommitPublished.foreach(doPublish(_))
closing.revokedCommitPublished.foreach(doPublish(_))
closing.futureRemoteCommitPublished.foreach(doPublish(_))
// no need to go OFFLINE, we can directly switch to CLOSING
goto(CLOSING) using closing