tsynchronizer: fix race - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cbd91ba5b1f9260b40b865180be39be3e63d3112 DIR parent 8ee1f140d8a530e5cb41ff204aa09cfef149f0b4 HTML Author: SomberNight <somber.night@protonmail.com> Date: Wed, 19 Sep 2018 21:41:10 +0200 synchronizer: fix race The synchronizer would sometimes not send 'wallet_updated' triggers if it was fast enough to do all the work between two 0.1 sec ticks. (is_up_to_date() would return True both before and after) Diffstat: M electrum/synchronizer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/synchronizer.py b/electrum/synchronizer.py t@@ -55,6 +55,7 @@ class Synchronizer(PrintError): self.requested_histories = {} self.requested_addrs = set() self.scripthash_to_address = {} + self._processed_some_notifications = False # so that we don't miss them # Queues self.add_queue = asyncio.Queue() self.status_queue = asyncio.Queue() t@@ -152,6 +153,7 @@ class Synchronizer(PrintError): h, status = await self.status_queue.get() addr = self.scripthash_to_address[h] await group.spawn(self.on_address_status, addr, status) + self._processed_some_notifications = True @property def session(self): t@@ -176,6 +178,8 @@ class Synchronizer(PrintError): await asyncio.sleep(0.1) self.wallet.synchronize() up_to_date = self.is_up_to_date() - if up_to_date != self.wallet.is_up_to_date(): + if (up_to_date != self.wallet.is_up_to_date() + or up_to_date and self._processed_some_notifications): + self._processed_some_notifications = False self.wallet.set_up_to_date(up_to_date) self.wallet.network.trigger_callback('wallet_updated', self.wallet)