gui: reload home if wallet is not syncing
This commit is contained in:
parent
327f0ea665
commit
71ad55e06b
@ -313,8 +313,11 @@ impl State for Home {
|
||||
daemon: Arc<dyn Daemon + Sync + Send>,
|
||||
wallet: Arc<Wallet>,
|
||||
) -> Command<Message> {
|
||||
// Wait for wallet to finish syncing before reloading data.
|
||||
if !self.sync_status.is_synced() {
|
||||
// If the wallet is syncing, we expect it to finish soon and so better to wait for
|
||||
// updated data before reloading. Besides, if the wallet is syncing, the DB may be
|
||||
// locked if the poller is running and we wouldn't be able to reload data until
|
||||
// syncing completes anyway.
|
||||
if self.sync_status.wallet_is_syncing() {
|
||||
return Command::none();
|
||||
}
|
||||
self.selected_event = None;
|
||||
|
||||
@ -207,6 +207,11 @@ impl SyncStatus {
|
||||
pub fn is_synced(&self) -> bool {
|
||||
self == &SyncStatus::Synced
|
||||
}
|
||||
|
||||
/// Whether the wallet itself, and not the blockchain, is syncing.
|
||||
pub fn wallet_is_syncing(&self) -> bool {
|
||||
self == &SyncStatus::WalletFullScan || self == &SyncStatus::LatestWalletSync
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the [`SyncStatus`].
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user