1
0
mirror of https://github.com/ACINQ/eclair.git synced 2025-01-19 13:43:43 +01:00

Indicate that wallet mode is needed before exiting (#368)

This commit is contained in:
Benoît Verret 2018-01-16 10:34:09 -05:00 committed by Pierre-Marie Padiou
parent 2804e8a919
commit d56ad99200

View File

@ -67,6 +67,8 @@ class Setup(datadir: File, overrideDefaults: Config = ConfigFactory.empty(), act
port = config.getInt("bitcoind.rpcport")))
val future = for {
json <- bitcoinClient.rpcClient.invoke("getblockchaininfo").recover { case _ => throw BitcoinRPCConnectionException }
// Make sure wallet support is enabled in bitcoind.
_ <- bitcoinClient.rpcClient.invoke("getbalance").recover { case _ => throw BitcoinWalletDisabledException }
progress = (json \ "verificationprogress").extract[Double]
chainHash <- bitcoinClient.rpcClient.invoke("getblockhash", 0).map(_.extract[String]).map(BinaryData(_)).map(x => BinaryData(x.reverse))
bitcoinVersion <- bitcoinClient.rpcClient.invoke("getnetworkinfo").map(json => (json \ "version")).map(_.extract[String])
@ -232,4 +234,6 @@ case object BitcoinZMQConnectionTimeoutException extends RuntimeException("could
case object BitcoinRPCConnectionException extends RuntimeException("could not connect to bitcoind using json-rpc")
case object BitcoinWalletDisabledException extends RuntimeException("bitcoind must have wallet support enabled")
case object EmptyAPIPasswordException extends RuntimeException("must set a password for the json-rpc api")