ui: Fix missing coin from data.

This commit is contained in:
tecnovert 2022-08-10 23:58:53 +02:00
parent 85bbccf82a
commit b179667cc5
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 13 additions and 7 deletions

View file

@ -500,7 +500,7 @@ class BasicSwap(BaseApp):
authcookiepath = os.path.join(self.getChainDatadirPath(coin), '.cookie') authcookiepath = os.path.join(self.getChainDatadirPath(coin), '.cookie')
pidfilename = cc['name'] pidfilename = cc['name']
if cc['name'] == 'bitcoin' or cc['name'] == 'litecoin' or cc['name'] == 'namecoin': if cc['name'] in ('bitcoin', 'litecoin', 'namecoin'):
pidfilename += 'd' pidfilename += 'd'
pidfilepath = os.path.join(self.getChainDatadirPath(coin), pidfilename + '.pid') pidfilepath = os.path.join(self.getChainDatadirPath(coin), pidfilename + '.pid')
@ -521,7 +521,10 @@ class BasicSwap(BaseApp):
datadir_pid = int(fp.read().decode('utf-8')) datadir_pid = int(fp.read().decode('utf-8'))
assert (datadir_pid == cc['pid']), 'Mismatched pid' assert (datadir_pid == cc['pid']), 'Mismatched pid'
assert (os.path.exists(authcookiepath)) assert (os.path.exists(authcookiepath))
except Exception: break
except Exception as e:
if self.debug:
self.log.warning('Error, iteration %d: %s', i, str(e))
self.delay_event.wait(0.5) self.delay_event.wait(0.5)
try: try:
if os.name != 'nt' or cc['core_version_group'] > 17: # Litecoin on windows doesn't write a pid file if os.name != 'nt' or cc['core_version_group'] > 17: # Litecoin on windows doesn't write a pid file

View file

@ -549,10 +549,13 @@ def page_offers(self, url_split, post_string, sent=False):
o.was_sent, o.was_sent,
ci_from.format_amount(completed_amount))) ci_from.format_amount(completed_amount)))
coins_from, coins_to = listAvailableCoins(swap_client, split_from=True)
template = server.env.get_template('offers.html') template = server.env.get_template('offers.html')
return self.render_template(template, { return self.render_template(template, {
'messages': messages, 'messages': messages,
'coins': listAvailableCoins(swap_client), 'coins_from': coins_from,
'coins': coins_to,
'messages': messages, 'messages': messages,
'filters': filters, 'filters': filters,
'offers': formatted_offers, 'offers': formatted_offers,

View file

@ -230,11 +230,11 @@ def prepare_swapclient_dir(datadir, node_id, network_key, network_pubkey, with_l
json.dump(settings, fp, indent=4) json.dump(settings, fp, indent=4)
def btcRpc(cmd, node_id=0): def btcCli(cmd, node_id=0):
return callrpc_cli(cfg.BITCOIN_BINDIR, os.path.join(TEST_DIR, 'btc_' + str(node_id)), 'regtest', cmd, cfg.BITCOIN_CLI) return callrpc_cli(cfg.BITCOIN_BINDIR, os.path.join(TEST_DIR, 'btc_' + str(node_id)), 'regtest', cmd, cfg.BITCOIN_CLI)
def ltcRpc(cmd, node_id=0): def ltcCli(cmd, node_id=0):
return callrpc_cli(cfg.LITECOIN_BINDIR, os.path.join(TEST_DIR, 'ltc_' + str(node_id)), 'regtest', cmd, cfg.LITECOIN_CLI) return callrpc_cli(cfg.LITECOIN_BINDIR, os.path.join(TEST_DIR, 'ltc_' + str(node_id)), 'regtest', cmd, cfg.LITECOIN_CLI)
@ -280,9 +280,9 @@ def run_coins_loop(cls):
pause_event.wait() pause_event.wait()
try: try:
if cls.btc_addr is not None: if cls.btc_addr is not None:
btcRpc('generatetoaddress 1 {}'.format(cls.btc_addr)) btcCli('generatetoaddress 1 {}'.format(cls.btc_addr))
if cls.ltc_addr is not None: if cls.ltc_addr is not None:
ltcRpc('generatetoaddress 1 {}'.format(cls.ltc_addr)) ltcCli('generatetoaddress 1 {}'.format(cls.ltc_addr))
if cls.xmr_addr is not None: if cls.xmr_addr is not None:
callrpc_xmr_na(XMR_BASE_RPC_PORT + 1, 'generateblocks', {'wallet_address': cls.xmr_addr, 'amount_of_blocks': 1}) callrpc_xmr_na(XMR_BASE_RPC_PORT + 1, 'generateblocks', {'wallet_address': cls.xmr_addr, 'amount_of_blocks': 1})
except Exception as e: except Exception as e: