commit e7fa42ce3ecef126d5e34fec206ec85173122d1b
parent cad4fb80c188e23061b220e0761db6d977e6c4b6
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 12 Sep 2018 20:25:13 +0200
wallet: don't write to disk when switching servers
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/electrum/address_synchronizer.py b/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,9 +177,10 @@ 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())
- self.save_transactions()
- self.save_verified_tx()
- self.storage.write()
+ if write_to_disk:
+ self.save_transactions()
+ self.save_verified_tx()
+ self.storage.write()
def add_address(self, address):
if address not in self.history: