mirror of
https://github.com/romanz/electrs.git
synced 2025-02-24 15:02:21 +01:00
Refactor waiting for daemon
This commit is contained in:
parent
50e55aa818
commit
6eb8eb5227
1 changed files with 10 additions and 6 deletions
|
@ -98,12 +98,16 @@ fn rpc_poll(client: &mut bitcoincore_rpc::Client) -> PollResult {
|
|||
match client.get_blockchain_info() {
|
||||
Ok(info) => {
|
||||
let left_blocks = info.headers - info.blocks;
|
||||
if info.initial_block_download {
|
||||
info!("waiting for IBD to finish: {} blocks left", left_blocks);
|
||||
return PollResult::Retry;
|
||||
}
|
||||
if left_blocks > 0 {
|
||||
info!("waiting for {} blocks to download", left_blocks);
|
||||
if info.initial_block_download || left_blocks > 0 {
|
||||
info!(
|
||||
"waiting for {} blocks to download{}",
|
||||
left_blocks,
|
||||
if info.initial_block_download {
|
||||
" (IBD)"
|
||||
} else {
|
||||
""
|
||||
}
|
||||
);
|
||||
return PollResult::Retry;
|
||||
}
|
||||
PollResult::Done(Ok(()))
|
||||
|
|
Loading…
Add table
Reference in a new issue