From e0461ae0961fd4f08b92f9eb659b61d3bbfab92e Mon Sep 17 00:00:00 2001 From: araspitzu Date: Wed, 18 Sep 2019 15:29:20 +0200 Subject: [PATCH] Update string to match on bitcoind while it's indexing (#1138) * Update string to match on bitcoind while it's indexing, doubleSpent() call * Check for bitcoind's getrawtransaction availablilty during startup --- eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala | 5 +++++ .../acinq/eclair/blockchain/bitcoind/BitcoinCoreWallet.scala | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala b/eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala index 5d4f0a1861..aac5a02c72 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala @@ -156,6 +156,11 @@ class Setup(datadir: File, .filter(value => (value \ "spendable").extract[Boolean]) .map(value => (value \ "address").extract[String]) } + _ <- chain match { + case "mainnet" => bitcoinClient.invoke("getrawtransaction", "2157b554dcfda405233906e461ee593875ae4b1b97615872db6a25130ecc1dd6") // coinbase of #500000 + case "testnet" => bitcoinClient.invoke("getrawtransaction", "8f38a0dd41dc0ae7509081e262d791f8d53ed6f884323796d5ec7b0966dd3825") // coinbase of #1500000 + case "regtest" => Future.successful(()) + } } yield (progress, ibd, chainHash, bitcoinVersion, unspentAddresses, blocks, headers) // blocking sanity checks val (progress, initialBlockDownload, chainHash, bitcoinVersion, unspentAddresses, blocks, headers) = await(future, 30 seconds, "bicoind did not respond after 30 seconds") diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/blockchain/bitcoind/BitcoinCoreWallet.scala b/eclair-core/src/main/scala/fr/acinq/eclair/blockchain/bitcoind/BitcoinCoreWallet.scala index f32856491e..efdd802f69 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/blockchain/bitcoind/BitcoinCoreWallet.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/blockchain/bitcoind/BitcoinCoreWallet.scala @@ -122,7 +122,7 @@ class BitcoinCoreWallet(rpcClient: BitcoinJsonRPCClient)(implicit ec: ExecutionC exists <- getTransaction(tx.txid) .map(_ => true) // we have found the transaction .recover { - case JsonRPCError(Error(_, message)) if message.contains("indexing") => + case JsonRPCError(Error(_, message)) if message.contains("index") => sys.error("Fatal error: bitcoind is indexing!!") System.exit(1) // bitcoind is indexing, that's a fatal error!! false // won't be reached