1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 14:22:39 +01:00

refusing to boot if bitcoind's sync progress is <= 0.99

This commit is contained in:
pm47 2017-02-10 14:41:42 +01:00
parent 1e10074f27
commit 8122b58229

View file

@ -58,10 +58,10 @@ class Setup() extends Logging {
implicit val formats = org.json4s.DefaultFormats
implicit val ec = ExecutionContext.Implicits.global
// TODO: check if bitcoind is in sync
val (chain, blockCount) = Await.result(bitcoin_client.client.invoke("getblockchaininfo").map(json => ((json \ "chain").extract[String], (json \ "blocks").extract[Long])), 10 seconds)
Globals.blockCount.set(blockCount)
val (chain, blockCount, progress) = Await.result(bitcoin_client.client.invoke("getblockchaininfo").map(json => ((json \ "chain").extract[String], (json \ "blocks").extract[Long], (json \ "verificationprogress").extract[Double])), 10 seconds)
assert(chain == "testnet" || chain == "regtest" || chain == "segnet4", "you should be on testnet or regtest or segnet4")
assert(progress > 0.99, "bitcoind should be synchronized")
Globals.blockCount.set(blockCount)
val bitcoinVersion = Await.result(bitcoin_client.client.invoke("getinfo").map(json => (json \ "version").extract[String]), 10 seconds)
// we use it as final payment address, so that funds are moved to the bitcoind wallet upon channel termination
val JString(finalAddress) = Await.result(bitcoin_client.client.invoke("getnewaddress"), 10 seconds)