wallet: don't write to disk when switching servers
This commit is contained in:
@@ -140,7 +140,7 @@ class AddressSynchronizer(PrintError):
|
|||||||
@aiosafe
|
@aiosafe
|
||||||
async def on_default_server_changed(self, event):
|
async def on_default_server_changed(self, event):
|
||||||
async with self.sync_restart_lock:
|
async with self.sync_restart_lock:
|
||||||
self.stop_threads()
|
self.stop_threads(write_to_disk=False)
|
||||||
await self._start_threads()
|
await self._start_threads()
|
||||||
|
|
||||||
def start_network(self, network):
|
def start_network(self, network):
|
||||||
@@ -169,7 +169,7 @@ class AddressSynchronizer(PrintError):
|
|||||||
interface.session.unsubscribe(synchronizer.status_queue)
|
interface.session.unsubscribe(synchronizer.status_queue)
|
||||||
await interface.group.spawn(job)
|
await interface.group.spawn(job)
|
||||||
|
|
||||||
def stop_threads(self):
|
def stop_threads(self, write_to_disk=True):
|
||||||
if self.network:
|
if self.network:
|
||||||
self.synchronizer = None
|
self.synchronizer = None
|
||||||
self.verifier = None
|
self.verifier = None
|
||||||
@@ -177,9 +177,10 @@ class AddressSynchronizer(PrintError):
|
|||||||
asyncio.run_coroutine_threadsafe(self.group.cancel_remaining(), self.network.asyncio_loop)
|
asyncio.run_coroutine_threadsafe(self.group.cancel_remaining(), self.network.asyncio_loop)
|
||||||
self.group = None
|
self.group = None
|
||||||
self.storage.put('stored_height', self.get_local_height())
|
self.storage.put('stored_height', self.get_local_height())
|
||||||
self.save_transactions()
|
if write_to_disk:
|
||||||
self.save_verified_tx()
|
self.save_transactions()
|
||||||
self.storage.write()
|
self.save_verified_tx()
|
||||||
|
self.storage.write()
|
||||||
|
|
||||||
def add_address(self, address):
|
def add_address(self, address):
|
||||||
if address not in self.history:
|
if address not in self.history:
|
||||||
|
|||||||
Reference in New Issue
Block a user