diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py index aaed906a7..607aa9fcb 100644 --- a/electrum/address_synchronizer.py +++ b/electrum/address_synchronizer.py @@ -88,7 +88,7 @@ class AddressSynchronizer(Logger): # Transactions pending verification. txid -> tx_height. Access with self.lock. self.unverified_tx = defaultdict(int) # true when synchronized - self.up_to_date = False + self._up_to_date = False # thread local storage for caching stuff self.threadlocal_cache = threading.local() @@ -650,15 +650,15 @@ class AddressSynchronizer(Logger): def set_up_to_date(self, up_to_date): with self.lock: - status_changed = self.up_to_date != up_to_date - self.up_to_date = up_to_date + status_changed = self._up_to_date != up_to_date + self._up_to_date = up_to_date if self.network: self.network.notify('status') if status_changed: self.logger.info(f'set_up_to_date: {up_to_date}') def is_up_to_date(self): - with self.lock: return self.up_to_date + return self._up_to_date def get_history_sync_state_details(self) -> Tuple[int, int]: if self.synchronizer: diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index 3bdd86895..d95b668a9 100644 --- a/electrum/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -927,7 +927,7 @@ class ElectrumWindow(App, Logger): self.num_blocks = self.network.get_local_height() server_height = self.network.get_server_height() server_lag = self.num_blocks - server_height - if not self.wallet.up_to_date or server_height == 0: + if not self.wallet.is_up_to_date() or server_height == 0: num_sent, num_answered = self.wallet.get_history_sync_state_details() status = ("{} [size=18dp]({}/{})[/size]" .format(_("Synchronizing..."), num_answered, num_sent)) @@ -951,7 +951,7 @@ class ElectrumWindow(App, Logger): def update_wallet_synchronizing_progress(self, *dt): if not self.wallet: return - if not self.wallet.up_to_date: + if not self.wallet.is_up_to_date(): self._trigger_update_status() def get_max_amount(self): @@ -1010,7 +1010,7 @@ class ElectrumWindow(App, Logger): #@profiler def update_wallet(self, *dt): self._trigger_update_status() - if self.wallet and (self.wallet.up_to_date or not self.network or not self.network.is_connected()): + if self.wallet and (self.wallet.is_up_to_date() or not self.network or not self.network.is_connected()): self.update_tabs() def notify(self, message): diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 5c21f5db1..d7d090131 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -836,7 +836,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): def notify_transactions(self): if self.tx_notification_queue.qsize() == 0: return - if not self.wallet.up_to_date: + if not self.wallet.is_up_to_date(): return # no notifications while syncing now = time.time() rate_limit = 20 # seconds @@ -883,7 +883,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): if self.need_update.is_set(): self.need_update.clear() self.update_wallet() - elif not self.wallet.up_to_date: + elif not self.wallet.is_up_to_date(): # this updates "synchronizing" progress self.update_status() # resolve aliases @@ -977,7 +977,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): # Server height can be 0 after switching to a new server # until we get a headers subscription request response. # Display the synchronizing message in that case. - if not self.wallet.up_to_date or server_height == 0: + if not self.wallet.is_up_to_date() or server_height == 0: num_sent, num_answered = self.wallet.get_history_sync_state_details() network_text = ("{} ({}/{})" .format(_("Synchronizing..."), num_answered, num_sent)) @@ -1022,7 +1022,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): def update_wallet(self): self.update_status() - if self.wallet.up_to_date or not self.network or not self.network.is_connected(): + if self.wallet.is_up_to_date() or not self.network or not self.network.is_connected(): self.update_tabs() def update_tabs(self, wallet=None): diff --git a/electrum/gui/stdio.py b/electrum/gui/stdio.py index 05480f34b..80990da47 100644 --- a/electrum/gui/stdio.py +++ b/electrum/gui/stdio.py @@ -118,7 +118,7 @@ class ElectrumGui(BaseElectrumGui): def get_balance(self): if self.wallet.network.is_connected(): - if not self.wallet.up_to_date: + if not self.wallet.is_up_to_date(): msg = _("Synchronizing...") else: c, u, x = self.wallet.get_balance() diff --git a/electrum/gui/text.py b/electrum/gui/text.py index 2d104fff2..5814b8ef5 100644 --- a/electrum/gui/text.py +++ b/electrum/gui/text.py @@ -148,7 +148,7 @@ class ElectrumGui(BaseElectrumGui): if not self.network: msg = _("Offline") elif self.network.is_connected(): - if not self.wallet.up_to_date: + if not self.wallet.is_up_to_date(): msg = _("Synchronizing...") else: c, u, x = self.wallet.get_balance()