diff --git a/gui/src/app/cache.rs b/gui/src/app/cache.rs index b4c54e30..e33f3153 100644 --- a/gui/src/app/cache.rs +++ b/gui/src/app/cache.rs @@ -10,7 +10,10 @@ pub struct Cache { pub coins: Vec, pub rescan_progress: Option, pub sync_progress: f64, + /// The most recent `last_poll_timestamp`. pub last_poll_timestamp: Option, + /// The `last_poll_timestamp` when starting the application. + pub last_poll_at_startup: Option, } /// only used for tests. @@ -24,6 +27,7 @@ impl std::default::Default for Cache { rescan_progress: None, sync_progress: 1.0, last_poll_timestamp: None, + last_poll_at_startup: None, } } } diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs index a09a0a89..9e5a4b60 100644 --- a/gui/src/app/mod.rs +++ b/gui/src/app/mod.rs @@ -284,6 +284,7 @@ impl App { let daemon = self.daemon.clone(); let datadir_path = self.cache.datadir_path.clone(); let network = self.cache.network; + let last_poll_at_startup = self.cache.last_poll_at_startup; Command::perform( async move { // we check every 10 second if the daemon poller is alive @@ -302,6 +303,7 @@ impl App { rescan_progress: info.rescan_progress, sync_progress: info.sync, last_poll_timestamp: info.last_poll_timestamp, + last_poll_at_startup, // doesn't change }) }, Message::UpdateCache, diff --git a/gui/src/loader.rs b/gui/src/loader.rs index 0f9b679a..28a6dd5b 100644 --- a/gui/src/loader.rs +++ b/gui/src/loader.rs @@ -407,7 +407,9 @@ pub async fn load_application( blockheight: info.block_height, coins, sync_progress: info.sync, + // Both last poll fields start with the same value. last_poll_timestamp: info.last_poll_timestamp, + last_poll_at_startup: info.last_poll_timestamp, ..Default::default() }; diff --git a/gui/src/main.rs b/gui/src/main.rs index 74b6cc85..57c0a120 100644 --- a/gui/src/main.rs +++ b/gui/src/main.rs @@ -462,7 +462,9 @@ pub fn create_app_with_remote_backend( sync_progress: 1.0, // Remote backend is always synced datadir_path: datadir.clone(), blockheight: wallet.tip_height.unwrap_or(0), - last_poll_timestamp: None, // We ignore this field for remote backend. + // We ignore last poll fields for remote backend. + last_poll_timestamp: None, + last_poll_at_startup: None, }, Arc::new( Wallet::new(wallet.descriptor)