main script: rm init_daemon (dead code), call sys_exit in init_cmdline
This commit is contained in:
27
run_electrum
27
run_electrum
@@ -106,29 +106,6 @@ def prompt_password(prompt, confirm=True):
|
|||||||
return password
|
return password
|
||||||
|
|
||||||
|
|
||||||
def init_daemon(config_options):
|
|
||||||
config = SimpleConfig(config_options)
|
|
||||||
storage = WalletStorage(config.get_wallet_path())
|
|
||||||
if not storage.file_exists():
|
|
||||||
print_msg("Error: Wallet file not found.")
|
|
||||||
print_msg("Type 'electrum create' to create a new wallet, or provide a path to a wallet with the -w option")
|
|
||||||
sys.exit(0)
|
|
||||||
if storage.is_encrypted():
|
|
||||||
if storage.is_encrypted_with_hw_device():
|
|
||||||
plugins = init_plugins(config, 'cmdline')
|
|
||||||
password = get_password_for_hw_device_encrypted_storage(plugins)
|
|
||||||
elif config.get('password'):
|
|
||||||
password = config.get('password')
|
|
||||||
else:
|
|
||||||
password = prompt_password('Password:', False)
|
|
||||||
if not password:
|
|
||||||
print_msg("Error: Password required")
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
password = None
|
|
||||||
config_options['password'] = password
|
|
||||||
|
|
||||||
|
|
||||||
def init_cmdline(config_options, server):
|
def init_cmdline(config_options, server):
|
||||||
config = SimpleConfig(config_options)
|
config = SimpleConfig(config_options)
|
||||||
cmdname = config.get('cmd')
|
cmdname = config.get('cmd')
|
||||||
@@ -150,7 +127,7 @@ def init_cmdline(config_options, server):
|
|||||||
if cmd.requires_wallet and not storage.file_exists():
|
if cmd.requires_wallet and not storage.file_exists():
|
||||||
print_msg("Error: Wallet file not found.")
|
print_msg("Error: Wallet file not found.")
|
||||||
print_msg("Type 'electrum create' to create a new wallet, or provide a path to a wallet with the -w option")
|
print_msg("Type 'electrum create' to create a new wallet, or provide a path to a wallet with the -w option")
|
||||||
sys.exit(0)
|
sys_exit(1)
|
||||||
|
|
||||||
# important warning
|
# important warning
|
||||||
if cmd.name in ['getprivatekeys']:
|
if cmd.name in ['getprivatekeys']:
|
||||||
@@ -171,7 +148,7 @@ def init_cmdline(config_options, server):
|
|||||||
password = prompt_password('Password:', False)
|
password = prompt_password('Password:', False)
|
||||||
if not password:
|
if not password:
|
||||||
print_msg("Error: Password required")
|
print_msg("Error: Password required")
|
||||||
sys.exit(1)
|
sys_exit(1)
|
||||||
else:
|
else:
|
||||||
password = None
|
password = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user