1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Fail if bitcoind is pruned or still in IBD

(with human-readable error message)
This commit is contained in:
Roman Zeyde 2018-08-02 16:38:47 +03:00
parent 308333f40b
commit 792dd8867a
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -91,6 +91,7 @@ pub struct BlockchainInfo {
bestblockhash: String, bestblockhash: String,
size_on_disk: u64, size_on_disk: u64,
pruned: bool, pruned: bool,
initialblockdownload: bool,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
@ -280,7 +281,16 @@ impl Daemon {
network_info.subversion, network_info.subversion,
) )
} }
debug!("{:?}", daemon.getblockchaininfo()?); let blockchain_info = daemon.getblockchaininfo()?;
debug!("{:?}", blockchain_info);
if blockchain_info.initialblockdownload == true {
bail!(ErrorKind::Connection(
"wait until bitcoin is synced (i.e. initialblockdownload = false)".to_owned()
))
}
if blockchain_info.pruned == true {
bail!("pruned node is not supported (use '-prune=0' bitcoind flag)".to_owned())
}
Ok(daemon) Ok(daemon)
} }