@@ -236,7 +236,7 @@ class Commands:
|
|||||||
@command('n')
|
@command('n')
|
||||||
async def close_wallet(self, wallet_path=None):
|
async def close_wallet(self, wallet_path=None):
|
||||||
"""Close wallet"""
|
"""Close wallet"""
|
||||||
return self.daemon.stop_wallet(wallet_path)
|
return await self.daemon._stop_wallet(wallet_path)
|
||||||
|
|
||||||
@command('')
|
@command('')
|
||||||
async def create(self, passphrase=None, password=None, encrypt_file=True, seed_type=None, wallet_path=None):
|
async def create(self, passphrase=None, password=None, encrypt_file=True, seed_type=None, wallet_path=None):
|
||||||
|
|||||||
@@ -521,13 +521,18 @@ class Daemon(Logger):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def stop_wallet(self, path: str) -> bool:
|
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."""
|
"""Returns True iff a wallet was found."""
|
||||||
path = standardize_path(path)
|
path = standardize_path(path)
|
||||||
wallet = self._wallets.pop(path, None)
|
wallet = self._wallets.pop(path, None)
|
||||||
if not wallet:
|
if not wallet:
|
||||||
return False
|
return False
|
||||||
fut = asyncio.run_coroutine_threadsafe(wallet.stop(), self.asyncio_loop)
|
await wallet.stop()
|
||||||
fut.result()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def run_daemon(self):
|
def run_daemon(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user