Skip to content

Commit

Permalink
gui: refresh cache more often while height is 0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jp1ac4 committed Oct 11, 2024
1 parent a511102 commit 6f4eb79
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gui/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit 6f4eb79

Please sign in to comment.