wallet.is_up_to_date: fix flickering during sync due to race
AddressSynchronizer.add_address called synchronizer.add, which would only schedule adding the addr to the Synchronizer in the next event loop iter. If during that time, the synchronizer called adb.set_up_to_date(True), the wallet would falsely believe and advertise itself as up_to_date (as the wallet would see wallet.synchronize not creating new addresses, and adb (via synchronizer) telling it is up_to_date). Moments later, the synchronizer._add_address is finally executed and up_to_date=False propagates out synchronizer->adb->wallet.
This commit is contained in:
@@ -32,12 +32,12 @@ class Notifier(SynchronizerBase):
|
||||
async def main(self):
|
||||
# resend existing subscriptions if we were restarted
|
||||
for addr in self.watched_addresses:
|
||||
await self._add_address(addr)
|
||||
self.add_address(addr)
|
||||
# main loop
|
||||
while True:
|
||||
addr = await self.watch_queue.get()
|
||||
self.watched_addresses.add(addr)
|
||||
await self._add_address(addr)
|
||||
self.add_address(addr)
|
||||
|
||||
async def _on_address_status(self, addr, status):
|
||||
print_msg(f"addr {addr}, status {status}")
|
||||
|
||||
Reference in New Issue
Block a user