1
0

commands: fix "close_wallet" cmd, which was deadlocking

fixes #7348
This commit is contained in:
SomberNight
2021-06-17 12:35:31 +02:00
parent 66628c0bad
commit 66f68d6b1f
2 changed files with 8 additions and 3 deletions

View File

@@ -521,13 +521,18 @@ class Daemon(Logger):
return False
def stop_wallet(self, path: str) -> bool:
"""Returns True iff a wallet was found."""
# note: this must not be called from the event loop. # TODO raise if so
fut = asyncio.run_coroutine_threadsafe(self._stop_wallet(path), self.asyncio_loop)
return fut.result()
async def _stop_wallet(self, path: str) -> bool:
"""Returns True iff a wallet was found."""
path = standardize_path(path)
wallet = self._wallets.pop(path, None)
if not wallet:
return False
fut = asyncio.run_coroutine_threadsafe(wallet.stop(), self.asyncio_loop)
fut.result()
await wallet.stop()
return True
def run_daemon(self):