commands: fix "close_wallet"
This commit is contained in:
@@ -58,6 +58,7 @@ from .simple_config import SimpleConfig
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .network import Network
|
||||
from .daemon import Daemon
|
||||
|
||||
|
||||
known_commands = {}
|
||||
@@ -111,7 +112,8 @@ class Commands:
|
||||
|
||||
def __init__(self, config: 'SimpleConfig',
|
||||
wallet: Abstract_Wallet,
|
||||
network: Optional['Network'], daemon=None, callback=None):
|
||||
network: Optional['Network'],
|
||||
daemon: 'Daemon' = None, callback=None):
|
||||
self.config = config
|
||||
self.wallet = wallet
|
||||
self.daemon = daemon
|
||||
@@ -190,13 +192,7 @@ class Commands:
|
||||
async def close_wallet(self):
|
||||
"""Close wallet"""
|
||||
path = self.config.get_wallet_path()
|
||||
path = standardize_path(path)
|
||||
if path in self.wallets:
|
||||
self.stop_wallet(path)
|
||||
response = True
|
||||
else:
|
||||
response = False
|
||||
return response
|
||||
return self.daemon.stop_wallet(path)
|
||||
|
||||
@command('')
|
||||
async def create(self, passphrase=None, password=None, encrypt_file=True, seed_type=None):
|
||||
|
||||
@@ -394,11 +394,14 @@ class Daemon(Logger):
|
||||
return True
|
||||
return False
|
||||
|
||||
def stop_wallet(self, path):
|
||||
def stop_wallet(self, path) -> bool:
|
||||
"""Returns True iff a wallet was found."""
|
||||
path = standardize_path(path)
|
||||
wallet = self.wallets.pop(path, None)
|
||||
if not wallet: return
|
||||
if not wallet:
|
||||
return False
|
||||
wallet.stop_threads()
|
||||
return True
|
||||
|
||||
async def run_cmdline(self, config_options):
|
||||
password = config_options.get('password')
|
||||
|
||||
Reference in New Issue
Block a user