Wait for IBD to finish (instead of failing)
This commit is contained in:
parent
6af64b6106
commit
74dfef8f09
|
@ -282,7 +282,7 @@ impl Daemon {
|
|||
signal.clone(),
|
||||
)?),
|
||||
message_id: Counter::new(),
|
||||
signal,
|
||||
signal: signal.clone(),
|
||||
latency: metrics.histogram_vec(
|
||||
HistogramOpts::new("daemon_rpc", "Bitcoind RPC latency (in seconds)"),
|
||||
&["method"],
|
||||
|
@ -302,14 +302,16 @@ impl Daemon {
|
|||
}
|
||||
let blockchain_info = daemon.getblockchaininfo()?;
|
||||
info!("{:?}", 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())
|
||||
}
|
||||
loop {
|
||||
if daemon.getblockchaininfo()?.initialblockdownload == false {
|
||||
break;
|
||||
}
|
||||
warn!("wait until bitcoind is synced (i.e. initialblockdownload = false)");
|
||||
signal.wait(Duration::from_secs(3))?;
|
||||
}
|
||||
Ok(daemon)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user