Skip to content

Commit

Permalink
Remove unnecessary safeSend from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remyers committed Nov 9, 2023
1 parent 394b3d8 commit 060a0d7
Showing 1 changed file with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class QuiescenceTestsCommon : LightningTestSuite() {
)
val (alice1, _, _) = initiateQuiescence(alice, bob, sendInitialStfu = false)
cmds.forEach {
safeSend(alice1, listOf(it)).second.findCommandError<ForbiddenDuringQuiescence>()
alice1.process(it).second.findCommandError<ForbiddenDuringQuiescence>()
}
}

Expand All @@ -92,12 +92,11 @@ class QuiescenceTestsCommon : LightningTestSuite() {
)
val (alice1, bob1, _) = initiateQuiescence(alice, bob, sendInitialStfu = true)
cmds.forEach {
safeSend(alice1, listOf(it)).second.findCommandError<ForbiddenDuringSplice>()
alice1.process(it).second.findCommandError<ForbiddenDuringSplice>()
}
cmds.forEach {
safeSend(bob1, listOf(it)).second.findCommandError<ForbiddenDuringSplice>()
bob1.process(it).second.findCommandError<ForbiddenDuringSplice>()
}
safeSend(bob, cmds)
}

@Test
Expand Down Expand Up @@ -459,19 +458,6 @@ class QuiescenceTestsCommon : LightningTestSuite() {
}
}

private fun safeSend(r: LNChannel<Normal>, cmds: List<ChannelCommand>): Pair<LNChannel<Normal>, List<ChannelAction>> {
var receiver: LNChannel<Normal> = r
val actions = buildList {
cmds.forEach {
val (r1, a) = receiver.process(it)
assertIs<LNChannel<Normal>>(r1)
receiver = r1
addAll(a)
}
}
return Pair(receiver, actions)
}

private fun initiateQuiescence(sender: LNChannel<Normal>, receiver: LNChannel<Normal>, sendInitialStfu: Boolean): Triple<LNChannel<Normal>, LNChannel<Normal>, LightningMessage> {
val cmd = ChannelCommand.Commitment.Splice.Request(
replyTo = CompletableDeferred(),
Expand Down

0 comments on commit 060a0d7

Please sign in to comment.