Better error message when trying to swap Firo <> XMR.

2024-05-20_merge
tecnovert 11 months ago
parent 3b6f72c084
commit a5c3534c19
  1. 5
      basicswap/basicswap.py
  2. 2
      basicswap/ui/page_offers.py
  3. 33
      tests/basicswap/common_xmr.py

@ -1239,7 +1239,10 @@ class BasicSwap(BaseApp):
if swap_type == SwapTypes.XMR_SWAP:
reverse_bid: bool = self.is_reverse_ads_bid(coin_from)
itx_coin = coin_to if reverse_bid else coin_from
if (itx_coin in self.coins_without_segwit + self.scriptless_coins):
ptx_coin = coin_from if reverse_bid else coin_to
if itx_coin in self.coins_without_segwit + self.scriptless_coins:
if ptx_coin in self.coins_without_segwit + self.scriptless_coins:
raise ValueError('{} -> {} is not currently supported'.format(coin_from.name, coin_to.name))
raise ValueError('Invalid swap type for: {} -> {}'.format(coin_from.name, coin_to.name))
else:
if coin_from in self.adaptor_swap_only_coins or coin_to in self.adaptor_swap_only_coins:

@ -173,7 +173,7 @@ def parseOfferFormData(swap_client, form_data, page_data, options={}):
try:
swap_client.validateSwapType(coin_from, coin_to, swap_type)
except Exception as e:
errors.append(f'Invalid Swap type {e}')
errors.append(f'{e}')
if have_data_entry(form_data, 'step1'):
if len(errors) == 0 and have_data_entry(form_data, 'continue'):

@ -47,6 +47,11 @@ BITCOIN_TOR_PORT_BASE = int(os.getenv('BITCOIN_TOR_PORT_BASE', BTC_BASE_TOR_PORT
LITECOIN_RPC_PORT_BASE = int(os.getenv('LITECOIN_RPC_PORT_BASE', LTC_BASE_RPC_PORT))
FIRO_BASE_PORT = 34832
FIRO_BASE_RPC_PORT = 35832
FIRO_RPC_PORT_BASE = int(os.getenv('FIRO_RPC_PORT_BASE', FIRO_BASE_RPC_PORT))
XMR_BASE_P2P_PORT = 17792
XMR_BASE_RPC_PORT = 29798
XMR_BASE_WALLET_RPC_PORT = 29998
@ -88,6 +93,7 @@ def run_prepare(node_id, datadir_path, bins_path, with_coins, mnemonic_in=None,
os.environ['PART_RPC_PORT'] = str(PARTICL_RPC_PORT_BASE)
os.environ['BTC_RPC_PORT'] = str(BITCOIN_RPC_PORT_BASE)
os.environ['LTC_RPC_PORT'] = str(LITECOIN_RPC_PORT_BASE)
os.environ['FIRO_RPC_PORT'] = str(FIRO_RPC_PORT_BASE)
os.environ['XMR_RPC_USER'] = 'xmr_user'
os.environ['XMR_RPC_PWD'] = 'xmr_pwd'
@ -234,6 +240,33 @@ def run_prepare(node_id, datadir_path, bins_path, with_coins, mnemonic_in=None,
for opt in EXTRA_CONFIG_JSON.get('pivx{}'.format(node_id), []):
fp.write(opt + '\n')
if 'firo' in coins_array:
# Pruned nodes don't provide blocks
with open(os.path.join(datadir_path, 'firo', 'firo.conf'), 'r') as fp:
lines = fp.readlines()
with open(os.path.join(datadir_path, 'firo', 'firo.conf'), 'w') as fp:
for line in lines:
if not line.startswith('prune'):
fp.write(line)
fp.write('port={}\n'.format(FIRO_BASE_PORT + node_id + port_ofs))
fp.write('bind=127.0.0.1\n')
fp.write('dnsseed=0\n')
fp.write('discover=0\n')
fp.write('listenonion=0\n')
fp.write('upnp=0\n')
if use_rpcauth:
salt = generate_salt(16)
rpc_user = 'test_firo_' + str(node_id)
rpc_pass = 'test_firo_pwd_' + str(node_id)
fp.write('rpcauth={}:{}${}\n'.format(rpc_user, salt, password_to_hmac(salt, rpc_pass)))
settings['chainclients']['firo']['rpcuser'] = rpc_user
settings['chainclients']['firo']['rpcpassword'] = rpc_pass
for ip in range(num_nodes):
if ip != node_id:
fp.write('connect=127.0.0.1:{}\n'.format(FIRO_BASE_PORT + ip + port_ofs))
for opt in EXTRA_CONFIG_JSON.get('firo{}'.format(node_id), []):
fp.write(opt + '\n')
if 'monero' in coins_array:
with open(os.path.join(datadir_path, 'monero', 'monerod.conf'), 'a') as fp:
fp.write('p2p-bind-ip=127.0.0.1\n')

Loading…
Cancel
Save