mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-22 14:22:39 +01:00
Filter out non-spendable outputs from bitcoind 'listunspent' call during setup (#605)
Fixes #599
This commit is contained in:
parent
644b4a2a98
commit
db43747d2b
1 changed files with 5 additions and 1 deletions
|
@ -99,7 +99,11 @@ class Setup(datadir: File, overrideDefaults: Config = ConfigFactory.empty(), act
|
|||
progress = (json \ "verificationprogress").extract[Double]
|
||||
chainHash <- bitcoinClient.invoke("getblockhash", 0).map(_.extract[String]).map(BinaryData(_)).map(x => BinaryData(x.reverse))
|
||||
bitcoinVersion <- bitcoinClient.invoke("getnetworkinfo").map(json => (json \ "version")).map(_.extract[String])
|
||||
unspentAddresses <- bitcoinClient.invoke("listunspent").collect { case JArray(values) => values.map(value => (value \ "address").extract[String]) }
|
||||
unspentAddresses <- bitcoinClient.invoke("listunspent").collect { case JArray(values) =>
|
||||
values
|
||||
.filter(value => (value \ "spendable").extract[Boolean])
|
||||
.map(value => (value \ "address").extract[String])
|
||||
}
|
||||
} yield (progress, chainHash, bitcoinVersion, unspentAddresses)
|
||||
// blocking sanity checks
|
||||
val (progress, chainHash, bitcoinVersion, unspentAddresses) = Await.result(future, 30 seconds)
|
||||
|
|
Loading…
Add table
Reference in a new issue