commit 43583c1e28b17de9d2818faad97742b8b8dc3cc9
parent d11481f36013cb55225bd1eda50dcbda43b872d2
Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 4 Mar 2019 02:49:41 +0100
daemon: make sure wallet paths are standardised everywhere
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/electrum/daemon.py b/electrum/daemon.py
@@ -138,6 +138,7 @@ class Daemon(DaemonThread):
if self.network:
self.network.start([self.fx.run])
self.gui = None
+ # path -> wallet; make sure path is standardized.
self.wallets = {} # type: Dict[str, Abstract_Wallet]
# Setup JSONRPC server
self.server = None
@@ -188,6 +189,7 @@ class Daemon(DaemonThread):
response = wallet is not None
elif sub == 'close_wallet':
path = config.get_wallet_path()
+ path = standardize_path(path)
if path in self.wallets:
self.stop_wallet(path)
response = True
@@ -258,9 +260,11 @@ class Daemon(DaemonThread):
def add_wallet(self, wallet: Abstract_Wallet):
path = wallet.storage.path
+ path = standardize_path(path)
self.wallets[path] = wallet
def get_wallet(self, path):
+ path = standardize_path(path)
return self.wallets.get(path)
def delete_wallet(self, path):
@@ -271,6 +275,7 @@ class Daemon(DaemonThread):
return False
def stop_wallet(self, path):
+ path = standardize_path(path)
wallet = self.wallets.pop(path, None)
if not wallet: return
wallet.stop_threads()
@@ -287,6 +292,7 @@ class Daemon(DaemonThread):
cmd = known_commands[cmdname]
if cmd.requires_wallet:
path = config.get_wallet_path()
+ path = standardize_path(path)
wallet = self.wallets.get(path)
if wallet is None:
return {'error': 'Wallet "%s" is not loaded. Use "electrum daemon load_wallet"'%os.path.basename(path) }