Skip to content

Commit

Permalink
fixup! Correct test for static_remotekey in PeerSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
araspitzu committed Apr 16, 2020
1 parent 4abf88d commit 233baa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ class ClosingStateSpec extends TestkitBaseClass with StateTestsHelperMethods {
test("recv BITCOIN_TX_CONFIRMED (future remote commit, option_static_remotekey)", Tag("static_remotekey")) { f =>
import f._
val bobCommitTx = testFutureRemoteCommitTxConfirmed(f)
// using option_static_remotekey alice doesn't need to swipe her output
// using option_static_remotekey alice doesn't need to sweep her output
awaitCond(alice.stateName == CLOSING, 10 seconds)
alice ! WatchEventConfirmed(BITCOIN_TX_CONFIRMED(bobCommitTx), 0, 0, bobCommitTx)
// after the commit tx is confirmed the channel is closed, no claim transactions needed
Expand Down
15 changes: 8 additions & 7 deletions eclair-core/src/test/scala/fr/acinq/eclair/io/PeerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package fr.acinq.eclair.io

import java.net.{InetAddress, ServerSocket}

import akka.actor.FSM.{CurrentState, SubscribeTransitionCallBack, Transition}
import akka.actor.Status.Failure
import akka.testkit.{TestFSMRef, TestProbe}
import com.google.common.net.HostAndPort
Expand All @@ -28,7 +27,7 @@ import fr.acinq.eclair.TestConstants._
import fr.acinq.eclair._
import fr.acinq.eclair.blockchain.{EclairWallet, TestWallet}
import fr.acinq.eclair.channel.states.StateTestsHelperMethods
import fr.acinq.eclair.channel.{CMD_GETINFO, Channel, ChannelCreated, ChannelVersion, DATA_NORMAL, HasCommitments, NORMAL, RES_GETINFO}
import fr.acinq.eclair.channel.{CMD_GETINFO, Channel, ChannelCreated, ChannelVersion, DATA_WAIT_FOR_ACCEPT_CHANNEL, HasCommitments, RES_GETINFO, WAIT_FOR_ACCEPT_CHANNEL}
import fr.acinq.eclair.io.Peer._
import fr.acinq.eclair.wire.{ChannelCodecsSpec, Color, NodeAddress, NodeAnnouncement}
import org.scalatest.{Outcome, Tag}
Expand Down Expand Up @@ -201,14 +200,16 @@ class PeerSpec extends TestkitBaseClass with StateTestsHelperMethods {

val probe = TestProbe()
connect(remoteNodeId, switchboard, peer, peerConnection, remoteInit = wire.Init(hex"2200")) // Bob supports option_static_remotekey
probe.send(peer, Peer.OpenChannel(remoteNodeId, 24000 sat, 0 msat, None, None, None))
awaitCond(peer.stateData.channels.nonEmpty)
peer.stateData.channels.foreach { case (_, channelRef) =>
probe.send(channelRef, CMD_GETINFO)
val info = probe.expectMsgType[RES_GETINFO]
assert(info.state == NORMAL)
val commitments = info.data.asInstanceOf[DATA_NORMAL].commitments
assert(commitments.channelVersion.isSet(ChannelVersion.USE_STATIC_REMOTEKEY_BIT))
assert(commitments.localParams.localPaymentBasepoint.isDefined)
assert(commitments.localParams.defaultFinalScriptPubKey === Script.pay2wpkh(commitments.localParams.localPaymentBasepoint.get))
assert(info.state == WAIT_FOR_ACCEPT_CHANNEL)
val inputInit = info.data.asInstanceOf[DATA_WAIT_FOR_ACCEPT_CHANNEL].initFunder
assert(inputInit.channelVersion.isSet(ChannelVersion.USE_STATIC_REMOTEKEY_BIT))
assert(inputInit.localParams.localPaymentBasepoint.isDefined)
assert(inputInit.localParams.defaultFinalScriptPubKey === Script.write(Script.pay2wpkh(inputInit.localParams.localPaymentBasepoint.get)))
}
}
}

0 comments on commit 233baa3

Please sign in to comment.