Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bitcoin 0.18.1 in the test #1148

Merged
merged 3 commits into from
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions eclair-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz
</bitcoind.url>
<bitcoind.md5>724043999e2b5ed0c088e8db34f15d43</bitcoind.md5>
<bitcoind.sha1>546ee35d4089c7ccc040a01cdff3362599b8bc53</bitcoind.sha1>
<bitcoind.md5>d3159a28702ca0cba2e0459e83219dfb</bitcoind.md5>
<bitcoind.sha1>969020835c1f0c759032def0d7b99669db06d8f7</bitcoind.sha1>
</properties>
</profile>
<profile>
Expand All @@ -93,10 +93,10 @@
</os>
</activation>
<properties>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-osx64.tar.gz
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz
</bitcoind.url>
<bitcoind.md5>b5a792c6142995faa42b768273a493bd</bitcoind.md5>
<bitcoind.sha1>8bd51c7024d71de07df381055993e9f472013db8</bitcoind.sha1>
<bitcoind.md5>0334b1024f28e83341c89df14e622bb6</bitcoind.md5>
<bitcoind.sha1>80354b40b409f342f5d35acd6b2c0e71f689285b</bitcoind.sha1>
</properties>
</profile>
<profile>
Expand All @@ -107,9 +107,9 @@
</os>
</activation>
<properties>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-win64.zip</bitcoind.url>
<bitcoind.md5>b0e824e9dd02580b5b01f073f3c89858</bitcoind.md5>
<bitcoind.sha1>4e17bad7d08c465b444143a93cd6eb1c95076e3f</bitcoind.sha1>
<bitcoind.url>https://bitcoin.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-win64.zip</bitcoind.url>
<bitcoind.md5>637776ca50b4354ca2f523bdee576bdb</bitcoind.md5>
<bitcoind.sha1>44771cc2161853b5230a7a159278dc8f27e7d4c2</bitcoind.sha1>
</properties>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import fr.acinq.eclair.blockchain.bitcoind.rpc.{BasicBitcoinJsonRPCClient, JsonR
import fr.acinq.eclair.transactions.Scripts
import fr.acinq.eclair.{LongToBtcAmount, addressToPublicKeyScript, randomKey}
import grizzled.slf4j.Logging
import org.json4s.JsonAST._
import org.json4s.{DefaultFormats, JString}
import org.json4s.JsonAST.{JString, _}
import org.json4s.{DefaultFormats}
import org.scalatest.{BeforeAndAfterAll, FunSuiteLike}

import scala.collection.JavaConversions._
Expand Down Expand Up @@ -275,7 +275,9 @@ class BitcoinCoreWalletSpec extends TestKit(ActorSystem("test")) with BitcoindSe
wallet.doubleSpent(tx1).pipeTo(sender.ref)
sender.expectMsg(false)
// let's confirm tx2
sender.send(bitcoincli, BitcoinReq("generate", 1))
sender.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = sender.expectMsgType[JValue]
sender.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
sender.expectMsgType[JValue](10 seconds)
// this time tx1 has been double spent
wallet.doubleSpent(tx1).pipeTo(sender.ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ trait BitcoindService extends Logging {
val INTEGRATION_TMP_DIR = new File(TestUtils.BUILD_DIRECTORY, s"integration-${UUID.randomUUID()}")
logger.info(s"using tmp dir: $INTEGRATION_TMP_DIR")

val PATH_BITCOIND = new File(TestUtils.BUILD_DIRECTORY, "bitcoin-0.17.1/bin/bitcoind")
val PATH_BITCOIND = new File(TestUtils.BUILD_DIRECTORY, "bitcoin-0.18.1/bin/bitcoind")
val PATH_BITCOIND_DATADIR = new File(INTEGRATION_TMP_DIR, "datadir-bitcoin")

var bitcoind: Process = null
Expand Down Expand Up @@ -107,7 +107,9 @@ trait BitcoindService extends Logging {
}
}, max = 3 minutes, interval = 2 seconds)
logger.info(s"generating initial blocks...")
sender.send(bitcoincli, BitcoinReq("generate", 150))
sender.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(address) = sender.expectMsgType[JValue]
sender.send(bitcoincli, BitcoinReq("generatetoaddress", 150, address))
val JArray(res) = sender.expectMsgType[JValue](3 minutes)
assert(res.size == 150)
awaitCond({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import com.typesafe.config.ConfigFactory
import fr.acinq.bitcoin.Transaction
import fr.acinq.eclair.blockchain.bitcoind.rpc.{BasicBitcoinJsonRPCClient, ExtendedBitcoinClient}
import grizzled.slf4j.Logging
import org.json4s.JsonAST._
import org.json4s.{DefaultFormats, JString}
import org.json4s.JsonAST.{JString, _}
import org.json4s.{DefaultFormats}
import org.scalatest.{BeforeAndAfterAll, FunSuiteLike}

import scala.collection.JavaConversions._
Expand Down Expand Up @@ -88,7 +88,9 @@ class ExtendedBitcoinClientSpec extends TestKit(ActorSystem("test")) with Bitcoi
client.publishTransaction(tx).pipeTo(sender.ref)
sender.expectMsg(txid)
// let's confirm the tx
bitcoinClient.invoke("generate", 1).pipeTo(sender.ref)
sender.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = sender.expectMsgType[JValue]
bitcoinClient.invoke("generatetoaddress", 1, generatingAddress).pipeTo(sender.ref)
sender.expectMsgType[JValue]
// and publish the tx a third time to test idempotence
client.publishTransaction(tx).pipeTo(sender.ref)
Expand All @@ -110,7 +112,7 @@ class ExtendedBitcoinClientSpec extends TestKit(ActorSystem("test")) with Bitcoi
client.publishTransaction(tx).pipeTo(sender.ref)
sender.expectMsg(txid)
// let's confirm the tx
bitcoinClient.invoke("generate", 1).pipeTo(sender.ref)
bitcoinClient.invoke("generatetoaddress", 1, generatingAddress).pipeTo(sender.ref)
sender.expectMsgType[JValue]
// and publish the tx a fifth time to test idempotence
client.publishTransaction(tx).pipeTo(sender.ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
sender.receiveOne(5 second).isInstanceOf[JValue]
}, max = 30 seconds, interval = 500 millis)
logger.info(s"generating initial blocks...")
sender.send(bitcoincli, BitcoinReq("generate", 150))
sender.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(address) = sender.expectMsgType[JValue]
sender.send(bitcoincli, BitcoinReq("generatetoaddress", 150, address))
sender.expectMsgType[JValue](30 seconds)
DockerReadyChecker.LogLineContains("INFO:BlockProcessor:height: 151").looped(attempts = 15, delay = 1 second)
}
Expand Down Expand Up @@ -117,7 +119,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
}, max = 30 seconds, interval = 1 second)

// confirm our tx
probe.send(bitcoincli, BitcoinReq("generate", 1))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand All @@ -133,8 +137,7 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
logger.info(s"sending 0.5 btc to $address1")
probe.send(bitcoincli, BitcoinReq("sendtoaddress", address1, 0.5))
probe.expectMsgType[JValue]

probe.send(bitcoincli, BitcoinReq("generate", 1))
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand Down Expand Up @@ -170,7 +173,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
unconfirmed1 == unconfirmed + amount + amount
}, max = 30 seconds, interval = 1 second)

probe.send(bitcoincli, BitcoinReq("generate", 1))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand Down Expand Up @@ -202,7 +207,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
assert(received === 100000000.sat)

logger.info("generating a new block")
probe.send(bitcoincli, BitcoinReq("generate", 1))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand Down Expand Up @@ -235,7 +242,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
probe.send(wallet, BroadcastTransaction(tx1))
val BroadcastTransactionResponse(_, None) = probe.expectMsgType[BroadcastTransactionResponse]

probe.send(bitcoincli, BitcoinReq("generate", 1))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand Down Expand Up @@ -268,7 +277,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
probe.send(wallet, BroadcastTransaction(tx1))
val BroadcastTransactionResponse(_, None) = probe.expectMsgType[BroadcastTransactionResponse]

probe.send(bitcoincli, BitcoinReq("generate", 1))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 1, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand Down Expand Up @@ -326,7 +337,9 @@ class ElectrumWalletSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
probe.send(wallet, IsDoubleSpent(tx2))
probe.expectMsg(IsDoubleSpentResponse(tx2, false))

probe.send(bitcoincli, BitcoinReq("generate", 2))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 2, generatingAddress))
probe.expectMsgType[JValue]

awaitCond({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import fr.acinq.eclair.blockchain.electrum.ElectrumClientPool.ElectrumServerAddr
import fr.acinq.eclair.blockchain._
import fr.acinq.eclair.channel.{BITCOIN_FUNDING_DEPTHOK, BITCOIN_FUNDING_SPENT}
import grizzled.slf4j.Logging
import org.json4s
import org.json4s.JsonAST.{JArray, JString, JValue}
import org.scalatest.{BeforeAndAfterAll, FunSuiteLike}
import scodec.bits._
Expand Down Expand Up @@ -72,9 +73,11 @@ class ElectrumWatcherSpec extends TestKit(ActorSystem("test")) with FunSuiteLike

val listener = TestProbe()
probe.send(watcher, WatchConfirmed(listener.ref, tx.txid, tx.txOut(0).publicKeyScript, 4, BITCOIN_FUNDING_DEPTHOK))
probe.send(bitcoincli, BitcoinReq("generate", 3))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 3, generatingAddress))
listener.expectNoMsg(1 second)
probe.send(bitcoincli, BitcoinReq("generate", 2))
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 2, generatingAddress))
val confirmed = listener.expectMsgType[WatchEventConfirmed](20 seconds)
assert(confirmed.tx.txid.toHex === txid)
system.stop(watcher)
Expand Down Expand Up @@ -119,7 +122,9 @@ class ElectrumWatcherSpec extends TestKit(ActorSystem("test")) with FunSuiteLike
listener.expectNoMsg(1 second)
probe.send(bitcoincli, BitcoinReq("sendrawtransaction", spendingTx.toString))
probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generate", 2))
probe.send(bitcoincli, BitcoinReq("getnewaddress"))
val JString(generatingAddress) = probe.expectMsgType[JValue]
probe.send(bitcoincli, BitcoinReq("generatetoaddress", 2, generatingAddress))
val blocks = probe.expectMsgType[JValue]
val JArray(List(JString(block1), JString(block2))) = blocks
val spent = listener.expectMsgType[WatchEventSpent](20 seconds)
Expand Down
Loading