Skip to content

Commit

Permalink
Change spliceStatus to Aborted after responding to SpliceInit wit…
Browse files Browse the repository at this point in the history
…h `TxAbort`
  • Loading branch information
remyers committed Nov 13, 2023
1 parent 370a7f4 commit 2ee9156
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ data class Normal(
is SpliceInit -> when (spliceStatus) {
is SpliceStatus.None -> {
logger.warning { "rejecting splice attempt: quiescence not negotiated" }
Pair(this@Normal, listOf(ChannelAction.Message.Send(TxAbort(channelId, InvalidSpliceNotQuiescent(channelId).message))))
Pair(this@Normal.copy(spliceStatus = SpliceStatus.Aborted), listOf(ChannelAction.Message.Send(TxAbort(channelId, InvalidSpliceNotQuiescent(channelId).message))))
}
is SpliceStatus.NonInitiatorQuiescent ->
if (commitments.isQuiescent()) {
Expand Down Expand Up @@ -485,7 +485,7 @@ data class Normal(
Pair(nextState, listOf(ChannelAction.Message.Send(spliceAck)))
} else {
logger.warning { "rejecting splice attempt: channel is not quiescent" }
Pair(this@Normal, listOf(ChannelAction.Message.Send(TxAbort(channelId, InvalidSpliceNotQuiescent(channelId).message))))
Pair(this@Normal.copy(spliceStatus = SpliceStatus.Aborted), listOf(ChannelAction.Message.Send(TxAbort(channelId, InvalidSpliceNotQuiescent(channelId).message))))
}
is SpliceStatus.Aborted -> {
logger.info { "rejecting splice attempt: our previous tx_abort was not acked" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,11 @@ class QuiescenceTestsCommon : LightningTestSuite() {
fun `receive SpliceInit when channel is not quiescent` () {
val (alice, _) = init()
val spliceInit = SpliceInit(alice.channelId, 500_000.sat, FeeratePerKw(253.sat), 0, Lightning.randomKey().publicKey())
val (_, actionsAlice) = alice.process(ChannelCommand.MessageReceived(spliceInit))
val (alice1, actionsAlice1) = alice.process(ChannelCommand.MessageReceived(spliceInit))
// quiescence not negotiated
actionsAlice.hasOutgoingMessage<TxAbort>()
actionsAlice1.hasOutgoingMessage<TxAbort>()
assertIs<LNChannel<Normal>>(alice1)
assertIs<SpliceStatus.Aborted>(alice1.state.spliceStatus)
}

companion object {
Expand Down

0 comments on commit 2ee9156

Please sign in to comment.