From 6f4eb79a5a45751a1c919565ea9c88f59fbda0ab Mon Sep 17 00:00:00 2001 From: Michael Mallan Date: Tue, 8 Oct 2024 14:59:00 +0100 Subject: [PATCH] gui: refresh cache more often while height is 0 The wallet's height is taken from the cache and is used to check if the wallet has been initially synced after creation. For the remote backend, the cache refresh should be done with the usual frequency while the wallet's height is 0 so that the sync completion can be detected sooner. --- gui/src/app/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs index 7e75873a..cc57fb89 100644 --- a/gui/src/app/mod.rs +++ b/gui/src/app/mod.rs @@ -221,12 +221,16 @@ impl App { Subscription::batch(vec![ time::every(Duration::from_secs( // LianaLite has no rescan feature, the cache refresh loop is only - // to fetch the new block height tip which is only used to warn user - // about recovery availability. - if self.daemon.backend() == DaemonBackend::RemoteBackend { + // to fetch the new block height tip, which for a synced wallet + // (height > 0) is only used to warn user about recovery availability. + if self.daemon.backend() == DaemonBackend::RemoteBackend + && self.cache.blockheight > 0 + { 120 // For the rescan feature, we set a higher frequency of cache refresh // to give to user an up-to-date view of the rescan progress. + // For a remote backend, we refresh cache more often while height is 0 + // to detect sooner that syncing has finished. } else { 10 },