preparescript: Fix addcoin

This commit is contained in:
tecnovert 2022-08-18 00:21:32 +02:00
parent 48e5dcbcc9
commit e4e35b0d89
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 6 additions and 4 deletions

View file

@ -608,7 +608,8 @@ class BasicSwap(BaseApp):
stopping = True
time.sleep(i + 1)
except Exception as ex:
if 'Could not connect' in str(ex):
str_ex = str(ex)
if 'Could not connect' in str_ex or 'Could not locate RPC credentials' in str_ex:
if stopping:
for i in range(30):
# The lock file doesn't get deleted

View file

@ -783,7 +783,7 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
with open(os.path.join(data_dir, 'basicswap.log'), 'a') as fp:
swap_client = BasicSwap(fp, data_dir, settings, chain)
start_daemons = with_coins
start_daemons = {c for c in with_coins}
if 'particl' not in with_coins:
# Particl must be running to initialise a wallet in addcoin mode
start_daemons.add('particl')
@ -808,7 +808,7 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
swap_client.waitForDaemonRPC(c, with_wallet=False)
# Create wallet if it doesn't exist yet
wallets = swap_client.callcoinrpc(c, 'listwallets')
if 'wallet.dat' not in wallets:
if len(wallets) < 1:
logger.info('Creating wallet.dat for {}.'.format(coin_name.capitalize()))
swap_client.callcoinrpc(c, 'createwallet', ['wallet.dat'])
@ -1171,7 +1171,7 @@ def main():
prepareDataDir(add_coin, settings, chain, particl_wallet_mnemonic, extra_opts)
if particl_wallet_mnemonic not in ('none', 'auto'):
initialise_wallets(None, [add_coin, ], data_dir, settings, chain, use_tor_proxy)
initialise_wallets(None, {add_coin, }, data_dir, settings, chain, use_tor_proxy)
with open(config_path, 'w') as fp:
json.dump(settings, fp, indent=4)

View file

@ -1,2 +1,3 @@
eventtypes
wit
ro