-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Milestone
Description
A daemon may need to perform transactions without receiving a command. Currently, the swapserver plugin requires the keystore to be unencrypted, see https://github.com/spesmilo/electrum/blob/master/electrum/submarine_swaps.py#L392. Another reason to store passwords in memory is anchor outputs #7509.
Note that the QML gui has been storing passwords as a field of qewallet. We should probably move that to a class that is not GUI-specific, such as wallet or to daemon.
Here is a small diff that stores passwords in the wallet object, and makes the CLI work without passing the password on each command.
index 326f86a1e..276c90237 100644
--- a/electrum/commands.py
+++ b/electrum/commands.py
@@ -146,6 +146,8 @@ def command(s):
if wallet is None:
raise Exception('wallet not loaded')
kwargs['wallet'] = wallet
+ if cmd.requires_password and password is None:
+ kwargs['password'] = wallet.password
wallet = kwargs.get('wallet') # type: Optional[Abstract_Wallet]
if cmd.requires_wallet and not wallet:
raise Exception('wallet not loaded')
diff --git a/electrum/daemon.py b/electrum/daemon.py
index 553b2a0ef..508381183 100644
--- a/electrum/daemon.py
+++ b/electrum/daemon.py
@@ -490,6 +490,8 @@ class Daemon(Logger):
wallet = self._load_wallet(path, password, manual_upgrades=manual_upgrades, config=self.config)
if wallet is None:
return
+ wallet.check_password(password)
+ wallet.password = password
wallet.start_network(self.network)
self.add_wallet(wallet)
return wallet
diff --git a/run_electrum b/run_electrum
index e8a965f40..ef9a24137 100755
--- a/run_electrum
+++ b/run_electrum
@@ -155,7 +155,7 @@ def init_cmdline(config_options, wallet_path, *, rpcserver: bool, config: 'Simpl
# commands needing password
if ((cmd.requires_wallet and storage.is_encrypted() and not rpcserver)
or (cmdname == 'load_wallet' and storage.is_encrypted())
- or cmd.requires_password):
+ or (cmd.requires_password and not rpcserver)):
if storage.is_encrypted_with_hw_device():
# this case is handled later in the control flow
password = None
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels