Browse Source

wallet: don't write to disk when switching servers

3.3.3.1
SomberNight 7 years ago
parent
commit
e7fa42ce3e
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 5
      electrum/address_synchronizer.py

5
electrum/address_synchronizer.py

@ -140,7 +140,7 @@ class AddressSynchronizer(PrintError):
@aiosafe
async def on_default_server_changed(self, event):
async with self.sync_restart_lock:
self.stop_threads()
self.stop_threads(write_to_disk=False)
await self._start_threads()
def start_network(self, network):
@ -169,7 +169,7 @@ class AddressSynchronizer(PrintError):
interface.session.unsubscribe(synchronizer.status_queue)
await interface.group.spawn(job)
def stop_threads(self):
def stop_threads(self, write_to_disk=True):
if self.network:
self.synchronizer = None
self.verifier = None
@ -177,6 +177,7 @@ class AddressSynchronizer(PrintError):
asyncio.run_coroutine_threadsafe(self.group.cancel_remaining(), self.network.asyncio_loop)
self.group = None
self.storage.put('stored_height', self.get_local_height())
if write_to_disk:
self.save_transactions()
self.save_verified_tx()
self.storage.write()

Loading…
Cancel
Save