prepare: addcoin activates the coin in settings.json and respects

preparebinonly mode.
2024-05-20_merge
tecnovert 5 years ago
parent bd93899066
commit 867fbf0d09
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 23
      bin/basicswap_prepare.py

@ -271,7 +271,7 @@ def waitForRPC(rpc_func, wallet=None):
def exitWithError(error_msg): def exitWithError(error_msg):
sys.stderr.write('Error: {}, exiting.\n'.format(error_msg)) sys.stderr.write('Error: {}, exiting.\n'.format(error_msg))
exit(1) sys.exit(1)
def main(): def main():
@ -332,6 +332,7 @@ def main():
if s[1] not in known_coins: if s[1] not in known_coins:
exitWithError('Unknown coin {}'.format(s[1])) exitWithError('Unknown coin {}'.format(s[1]))
add_coin = s[1] add_coin = s[1]
with_coins = [add_coin, ]
continue continue
exitWithError('Unknown argument {}'.format(v)) exitWithError('Unknown argument {}'.format(v))
@ -399,10 +400,11 @@ def main():
settings['chainclients'][add_coin] = chainclients[add_coin] settings['chainclients'][add_coin] = chainclients[add_coin]
prepareCore(add_coin, known_coins[add_coin], settings, data_dir) prepareCore(add_coin, known_coins[add_coin], settings, data_dir)
prepareDataDir(add_coin, settings, data_dir, chain, particl_wallet_mnemonic)
with open(config_path, 'w') as fp: if not prepare_bin_only:
json.dump(settings, fp, indent=4) prepareDataDir(add_coin, settings, data_dir, chain, particl_wallet_mnemonic)
with open(config_path, 'w') as fp:
json.dump(settings, fp, indent=4)
logger.info('Done.') logger.info('Done.')
return 0 return 0
@ -425,20 +427,15 @@ def main():
'check_expired_seconds': 60 'check_expired_seconds': 60
} }
for c, v in known_coins.items(): for c in with_coins:
if c not in with_coins: prepareCore(c, known_coins[c], settings, data_dir)
continue
coin = c
prepareCore(coin, v, settings, data_dir)
if prepare_bin_only: if prepare_bin_only:
logger.info('Done.') logger.info('Done.')
return 0 return 0
for c, v in known_coins.items(): for c in with_coins:
if c not in with_coins: prepareDataDir(c, settings, data_dir, chain, particl_wallet_mnemonic)
continue
prepareDataDir(coin, settings, data_dir, chain, particl_wallet_mnemonic)
with open(config_path, 'w') as fp: with open(config_path, 'w') as fp:
json.dump(settings, fp, indent=4) json.dump(settings, fp, indent=4)

Loading…
Cancel
Save