mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Fail if bitcoind is pruned or still in IBD
(with human-readable error message)
This commit is contained in:
parent
308333f40b
commit
792dd8867a
@ -91,6 +91,7 @@ pub struct BlockchainInfo {
|
||||
bestblockhash: String,
|
||||
size_on_disk: u64,
|
||||
pruned: bool,
|
||||
initialblockdownload: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@ -280,7 +281,16 @@ impl Daemon {
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user