Skip to content

Commit

Permalink
Update string to match on bitcoind while it's indexing (#1138)
Browse files Browse the repository at this point in the history
* Update string to match on bitcoind while it's indexing, doubleSpent() call

* Check for bitcoind's getrawtransaction availablilty during startup
  • Loading branch information
araspitzu authored Sep 18, 2019
1 parent bac0829 commit e0461ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e0461ae

Please sign in to comment.