From 5b6f44769230cc3f71784a76e51348457e0dd889 Mon Sep 17 00:00:00 2001 From: tecnovert <tecnovert@tecnovert.net> Date: Fri, 1 Dec 2023 09:23:10 +0200 Subject: [PATCH] tests: Update swap type validation. --- basicswap/basicswap.py | 4 +--- tests/basicswap/test_run.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index bc61727..20c2a81 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -1168,9 +1168,7 @@ 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): - raise ValueError('Invalid swap type for: {} -> {}'.format(coin_from.name, coin_to.name)) - if (coin_from in self.scriptless_coins and coin_to in self.scriptless_coins): + if (itx_coin in self.coins_without_segwit + self.scriptless_coins): 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: diff --git a/tests/basicswap/test_run.py b/tests/basicswap/test_run.py index 89a7b30..3c5b4ab 100644 --- a/tests/basicswap/test_run.py +++ b/tests/basicswap/test_run.py @@ -193,10 +193,10 @@ class Test(BaseTest): (Coins.BTC, Coins.FIRO, SwapTypes.XMR_SWAP), (Coins.FIRO, Coins.BTC, SwapTypes.SELLER_FIRST), (Coins.BTC, Coins.FIRO, SwapTypes.SELLER_FIRST), + (Coins.FIRO, Coins.BTC, SwapTypes.XMR_SWAP), ] should_fail = [ (Coins.BTC, Coins.XMR, SwapTypes.SELLER_FIRST), - (Coins.FIRO, Coins.BTC, SwapTypes.XMR_SWAP), (Coins.XMR, Coins.PART_ANON, SwapTypes.XMR_SWAP), (Coins.FIRO, Coins.PART_ANON, SwapTypes.XMR_SWAP), (Coins.PART_ANON, Coins.FIRO, SwapTypes.XMR_SWAP),