Skip to content

Commit

Permalink
Emit a final progress notification when syncing/scanning is completed
Browse files Browse the repository at this point in the history
  • Loading branch information
shesek committed Jan 6, 2021
1 parent a952827 commit fdd46f3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/util/bitcoincore_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ pub trait RpcApiExt: RpcApi {
if info.blocks == info.headers
&& (!info.initial_block_download || info.chain == "regtest")
{
if let Some(ref progress_tx) = progress_tx {
let progress = Progress::Sync {
progress_n: 1.0,
tip: info.median_time,
};
progress_tx.send(progress).ok();
}
break info;
}

Expand Down Expand Up @@ -93,6 +100,15 @@ pub trait RpcApiExt: RpcApi {
break info;
}
Some(ScanningDetails::NotScanning(_)) => {
if let Some(ref progress_tx) = progress_tx {
let progress = Progress::Scan {
progress_n: 1.0,
eta: 0,
};
if progress_tx.send(progress).is_err() {
break info;
}
}
// wait_wallet_scan() could be called before scanning actually started,
// give it a few seconds to start up before giving up
if !wait_for_scanning || start.elapsed().as_secs() > 3 {
Expand Down

0 comments on commit fdd46f3

Please sign in to comment.