mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-22 14:22:39 +01:00
removed special handling of CMD_CLOSE from WAIT_FOR_FUNDING_LOCKED_INTERNAL->NORMAL
This commit is contained in:
parent
4e7021d7c8
commit
a43dc181c6
4 changed files with 8 additions and 38 deletions
|
@ -319,24 +319,9 @@ class Channel(val remote: ActorRef, val blockchain: ActorRef, router: ActorRef,
|
|||
|
||||
case Event(WatchEventSpent(BITCOIN_FUNDING_SPENT, _), d: DATA_WAIT_FOR_FUNDING_LOCKED_INTERNAL) => handleInformationLeak(d)
|
||||
|
||||
case Event(cmd: CMD_CLOSE, d: DATA_WAIT_FOR_FUNDING_LOCKED_INTERNAL) =>
|
||||
val commitTx = d.commitments.localCommit.publishableTxs.commitTx.tx
|
||||
blockchain ! PublishAsap(commitTx)
|
||||
blockchain ! WatchConfirmed(self, commitTx.txid, d.params.minimumDepth, BITCOIN_CLOSE_DONE)
|
||||
// there can't be htlcs at this stage
|
||||
val localCommitPublished = LocalCommitPublished(commitTx, None, Nil, Nil, Nil)
|
||||
goto(CLOSING) using DATA_CLOSING(d.commitments, localCommitPublished = Some(localCommitPublished))
|
||||
case Event(cmd: CMD_CLOSE, d: DATA_WAIT_FOR_FUNDING_LOCKED_INTERNAL) => spendLocalCurrent(d)
|
||||
|
||||
case Event(e: Error, d: DATA_WAIT_FOR_FUNDING_LOCKED_INTERNAL) =>
|
||||
log.error(s"peer sent $e, closing connection")
|
||||
// see bolt #2: A node MUST fail the connection if it receives an err message
|
||||
val commitTx = d.commitments.localCommit.publishableTxs.commitTx.tx
|
||||
blockchain ! PublishAsap(commitTx)
|
||||
blockchain ! WatchConfirmed(self, commitTx.txid, d.params.minimumDepth, BITCOIN_LOCALCOMMIT_DONE)
|
||||
// there can't be htlcs at this stage
|
||||
// TODO: LocalCommitPublished.claimDelayedOutputTx should be defined
|
||||
val localCommitPublished = LocalCommitPublished(commitTx, None, Nil, Nil, Nil)
|
||||
goto(CLOSING) using DATA_CLOSING(d.commitments, localCommitPublished = Some(localCommitPublished))
|
||||
case Event(e: Error, d: DATA_WAIT_FOR_FUNDING_LOCKED_INTERNAL) => handleRemoteError(e, d)
|
||||
})
|
||||
|
||||
when(WAIT_FOR_FUNDING_LOCKED)(handleExceptions {
|
||||
|
@ -362,14 +347,7 @@ class Channel(val remote: ActorRef, val blockchain: ActorRef, router: ActorRef,
|
|||
|
||||
case Event(WatchEventSpent(BITCOIN_FUNDING_SPENT, _), d: DATA_NORMAL) => handleInformationLeak(d)
|
||||
|
||||
case Event(cmd: CMD_CLOSE, d: DATA_NORMAL) =>
|
||||
val commitTx = d.commitments.localCommit.publishableTxs.commitTx.tx
|
||||
blockchain ! PublishAsap(commitTx)
|
||||
blockchain ! WatchConfirmed(self, commitTx.txid, d.params.minimumDepth, BITCOIN_CLOSE_DONE)
|
||||
// there can't be htlcs at this stage
|
||||
// TODO: LocalCommitPublished.claimDelayedOutputTx should be defined
|
||||
val localCommitPublished = LocalCommitPublished(commitTx, None, Nil, Nil, Nil)
|
||||
goto(CLOSING) using DATA_CLOSING(d.commitments, localCommitPublished = Some(localCommitPublished))
|
||||
case Event(cmd: CMD_CLOSE, d: DATA_NORMAL) => spendLocalCurrent(d)
|
||||
|
||||
case Event(e: Error, d: DATA_NORMAL) => handleRemoteError(e, d)
|
||||
})
|
||||
|
@ -394,17 +372,9 @@ class Channel(val remote: ActorRef, val blockchain: ActorRef, router: ActorRef,
|
|||
|
||||
case Event(WatchEventSpent(BITCOIN_FUNDING_SPENT, _), d: DATA_NORMAL) => handleInformationLeak(d)
|
||||
|
||||
case Event(cmd: CMD_CLOSE, d: DATA_NORMAL) =>
|
||||
val commitTx = d.commitments.localCommit.publishableTxs.commitTx.tx
|
||||
blockchain ! PublishAsap(commitTx)
|
||||
blockchain ! WatchConfirmed(self, commitTx.txid, d.params.minimumDepth, BITCOIN_CLOSE_DONE)
|
||||
// there can't be htlcs at this stage
|
||||
// TODO: LocalCommitPublished.claimDelayedOutputTx should be defined
|
||||
val localCommitPublished = LocalCommitPublished(commitTx, None, Nil, Nil, Nil)
|
||||
goto(CLOSING) using DATA_CLOSING(d.commitments, localCommitPublished = Some(localCommitPublished))
|
||||
case Event(cmd: CMD_CLOSE, d: DATA_NORMAL) => spendLocalCurrent(d)
|
||||
|
||||
case Event(e: Error, d: DATA_NORMAL)
|
||||
=> handleRemoteError(e, d)
|
||||
case Event(e: Error, d: DATA_NORMAL) => handleRemoteError(e, d)
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class WaitForAnnSignaturesStateSpec extends TestkitBaseClass {
|
|||
alice ! CMD_CLOSE(None)
|
||||
awaitCond(alice.stateName == CLOSING)
|
||||
alice2blockchain.expectMsg(PublishAsap(tx))
|
||||
assert(alice2blockchain.expectMsgType[WatchConfirmed].event === BITCOIN_CLOSE_DONE)
|
||||
assert(alice2blockchain.expectMsgType[WatchConfirmed].event === BITCOIN_LOCALCOMMIT_DONE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class WaitForFundingLockedInternalStateSpec extends TestkitBaseClass {
|
|||
alice ! CMD_CLOSE(None)
|
||||
awaitCond(alice.stateName == CLOSING)
|
||||
alice2blockchain.expectMsg(PublishAsap(tx))
|
||||
assert(alice2blockchain.expectMsgType[WatchConfirmed].event === BITCOIN_CLOSE_DONE)
|
||||
assert(alice2blockchain.expectMsgType[WatchConfirmed].event === BITCOIN_LOCALCOMMIT_DONE)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ class WaitForFundingLockedStateSpec extends TestkitBaseClass {
|
|||
alice ! CMD_CLOSE(None)
|
||||
awaitCond(alice.stateName == CLOSING)
|
||||
alice2blockchain.expectMsg(PublishAsap(tx))
|
||||
assert(alice2blockchain.expectMsgType[WatchConfirmed].event === BITCOIN_CLOSE_DONE)
|
||||
assert(alice2blockchain.expectMsgType[WatchConfirmed].event === BITCOIN_LOCALCOMMIT_DONE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue