mirror of
https://github.com/romanz/electrs.git
synced 2025-02-24 23:08:39 +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() {
|
match client.get_blockchain_info() {
|
||||||
Ok(info) => {
|
Ok(info) => {
|
||||||
let left_blocks = info.headers - info.blocks;
|
let left_blocks = info.headers - info.blocks;
|
||||||
if info.initial_block_download {
|
if info.initial_block_download || left_blocks > 0 {
|
||||||
info!("waiting for IBD to finish: {} blocks left", left_blocks);
|
info!(
|
||||||
return PollResult::Retry;
|
"waiting for {} blocks to download{}",
|
||||||
}
|
left_blocks,
|
||||||
if left_blocks > 0 {
|
if info.initial_block_download {
|
||||||
info!("waiting for {} blocks to download", left_blocks);
|
" (IBD)"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
);
|
||||||
return PollResult::Retry;
|
return PollResult::Retry;
|
||||||
}
|
}
|
||||||
PollResult::Done(Ok(()))
|
PollResult::Done(Ok(()))
|
||||||
|
|
Loading…
Add table
Reference in a new issue