1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-20 10:39:19 +01:00

setting watches when restoring in CLOSING state

This commit is contained in:
pm47 2017-04-07 16:11:02 +02:00 committed by Pierre-Marie Padiou
parent c94972f7ce
commit 5bcf2f4ae7

View File

@ -97,6 +97,9 @@ class Channel(val nodeParams: NodeParams, remoteNodeId: PublicKey, blockchain: A
case Event(INPUT_RESTORED(data), _) =>
log.info(s"restoring channel $data")
context.system.eventStream.publish(ChannelRestored(self, context.parent, remoteNodeId, data.commitments.localParams.isFunder, data.channelId, data))
// TODO: should we wait for an acknowledgment from the watcher?
blockchain ! WatchSpent(self, data.commitments.commitInput.outPoint.txid, data.commitments.commitInput.outPoint.index.toInt, BITCOIN_FUNDING_SPENT)
blockchain ! WatchLost(self, data.commitments.commitInput.outPoint.txid, nodeParams.minDepthBlocks, BITCOIN_FUNDING_LOST)
data match {
//NB: order matters!
case closing: DATA_CLOSING =>
@ -109,9 +112,6 @@ class Channel(val nodeParams: NodeParams, remoteNodeId: PublicKey, blockchain: A
goto(CLOSING) using closing
case d: HasCommitments =>
// TODO: should we wait for an acknowledgment from the watcher?
blockchain ! WatchSpent(self, d.commitments.commitInput.outPoint.txid, d.commitments.commitInput.outPoint.index.toInt, BITCOIN_FUNDING_SPENT)
blockchain ! WatchLost(self, d.commitments.commitInput.outPoint.txid, nodeParams.minDepthBlocks, BITCOIN_FUNDING_LOST)
d match {
case DATA_NORMAL(_, Some(shortChannelId)) =>
context.system.eventStream.publish(ShortChannelIdAssigned(self, d.channelId, shortChannelId))