Skip to content

Commit

Permalink
main script: rm init_daemon (dead code), call sys_exit in init_cmdline
Browse files Browse the repository at this point in the history
  • Loading branch information
ecdsa committed Aug 31, 2019
1 parent 936d1e0 commit 0702338
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions run_electrum
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,6 @@ def prompt_password(prompt, confirm=True):
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):
config = SimpleConfig(config_options)
cmdname = config.get('cmd')
Expand All @@ -150,7 +127,7 @@ def init_cmdline(config_options, server):
if cmd.requires_wallet and 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)
sys_exit(1)

# important warning
if cmd.name in ['getprivatekeys']:
Expand All @@ -171,7 +148,7 @@ def init_cmdline(config_options, server):
password = prompt_password('Password:', False)
if not password:
print_msg("Error: Password required")
sys.exit(1)
sys_exit(1)
else:
password = None

Expand Down

0 comments on commit 0702338

Please sign in to comment.