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.
This commit is contained in:
Michael Mallan 2024-10-08 14:59:00 +01:00
parent a51110269c
commit 6f4eb79a5a
No known key found for this signature in database
GPG Key ID: 5177CDCEDB0EABEB

View File

@ -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
},