From 61f2654f31701f82bf57df1fb12fee880bccdf6e Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 23 Dec 2022 09:35:29 +0000 Subject: [PATCH] wallet: fire fewer 'status' and 'wallet_updated' triggers Especially during initial history sync, there are a lot of False->False up_to_date transitions (e.g. adb.add_address generates one), and the GUI does some work for each, which adds up to a lot of CPU usage for the full sync. --- electrum/wallet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/electrum/wallet.py b/electrum/wallet.py index 6795e5949..35dce435b 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -465,8 +465,9 @@ class Abstract_Wallet(ABC, Logger, EventListener): self.adb.reset_netrequest_counters() # sync progress indicator self.save_db() # fire triggers - util.trigger_callback('wallet_updated', self) - util.trigger_callback('status') + if status_changed or up_to_date: # suppress False->False transition, as it is spammy + util.trigger_callback('wallet_updated', self) + util.trigger_callback('status') if status_changed: self.logger.info(f'set_up_to_date: {up_to_date}')