diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs index aaf5e8f1..bf0c4bf7 100644 --- a/gui/src/app/mod.rs +++ b/gui/src/app/mod.rs @@ -67,6 +67,7 @@ impl Panels { wallet.clone(), &cache.coins, cache.blockheight, + cache.sync_progress, cache.last_poll_timestamp, daemon_backend.clone(), ), diff --git a/gui/src/app/state/mod.rs b/gui/src/app/state/mod.rs index 57841da1..00b1489e 100644 --- a/gui/src/app/state/mod.rs +++ b/gui/src/app/state/mod.rs @@ -79,10 +79,13 @@ pub fn redirect(menu: Menu) -> Command { fn sync_status( daemon_backend: DaemonBackend, blockheight: i32, + sync_progress: f64, last_poll: Option, last_poll_at_startup: Option, ) -> SyncStatus { - if blockheight <= 0 { + if sync_progress < 1.0 { + return SyncStatus::BlockchainSync(sync_progress); + } else if blockheight <= 0 { // If blockheight <= 0, then this is a newly created wallet. // If user imported descriptor and is using a local bitcoind, a rescan // will need to be performed in order to see past transactions and so the @@ -134,6 +137,7 @@ impl Home { wallet: Arc, coins: &[Coin], blockheight: i32, + sync_progress: f64, last_poll: Option, daemon_backend: DaemonBackend, ) -> Self { @@ -150,7 +154,13 @@ impl Home { }, ); - let sync_status = sync_status(daemon_backend, blockheight, last_poll, last_poll); + let sync_status = sync_status( + daemon_backend, + blockheight, + sync_progress, + last_poll, + last_poll, + ); Self { wallet, @@ -174,11 +184,13 @@ impl Home { &self, daemon_backend: DaemonBackend, blockheight: i32, + sync_progress: f64, last_poll: Option, ) -> SyncStatus { sync_status( daemon_backend, blockheight, + sync_progress, last_poll, self.last_poll_at_startup, ) @@ -296,6 +308,7 @@ impl State for Home { self.sync_status = self.sync_status( daemon.backend(), cache.blockheight, + cache.sync_progress, cache.last_poll_timestamp, ); // If this is the current panel, reload it if wallet is no longer syncing. diff --git a/gui/src/app/view/home.rs b/gui/src/app/view/home.rs index 6da3bce2..c4bcdead 100644 --- a/gui/src/app/view/home.rs +++ b/gui/src/app/view/home.rs @@ -62,11 +62,14 @@ pub fn home_view<'a>( Some( Row::new() .push( - text(if *sync_status == SyncStatus::WalletFullScan { - "Syncing" - } else { - "Checking for new transactions" - }) + match sync_status { + SyncStatus::BlockchainSync(progress) => text(format!( + "Syncing blockchain ({:.1}%)", + 100.0 * *progress + )), + SyncStatus::WalletFullScan => text("Syncing"), + _ => text("Checking for new transactions"), + } .style(color::GREY_2), ) .push(spinner::typing_text_carousel( diff --git a/gui/src/app/wallet.rs b/gui/src/app/wallet.rs index 9dfade00..506e3984 100644 --- a/gui/src/app/wallet.rs +++ b/gui/src/app/wallet.rs @@ -197,6 +197,8 @@ pub enum SyncStatus { WalletFullScan, /// Wallet is syncing with latest transactions. LatestWalletSync, + /// Blockchain is syncing with given progress between 0.0 and 1.0. + BlockchainSync(f64), } impl SyncStatus {