From ce578f802505dcbcb5522327279db793a21e4533 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Thu, 30 Nov 2023 18:16:24 +0200 Subject: [PATCH] Always use csv with adaptor sig swaps. --- basicswap/basicswap.py | 2 +- basicswap/interface/btc.py | 2 +- basicswap/ui/page_offers.py | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 787e920..4488eea 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -4706,7 +4706,7 @@ class BasicSwap(BaseApp): bid_id = bid_accept_data.bid_msg_id bid, offer = self.getBidAndOffer(bid_id) - ensure(bid is not None and bid.was_sent is True, 'Unknown bidid') + ensure(bid is not None and bid.was_sent is True, 'Unknown bid_id') ensure(offer, 'Offer not found ' + bid.offer_id.hex()) ensure(bid.expire_at > now + self._bid_expired_leeway, 'Bid expired') diff --git a/basicswap/interface/btc.py b/basicswap/interface/btc.py index 7ac78b7..bd04a95 100644 --- a/basicswap/interface/btc.py +++ b/basicswap/interface/btc.py @@ -1388,7 +1388,7 @@ class BTCInterface(CoinInterface): num_utxos = len(msg_utxos) // 34 p: int = 0 for i in range(num_utxos): - proof_utxos.append((msg_utxos[p: p + 32], int.from_bytes(msg_utxos[p + 32: p + 34]))) + proof_utxos.append((msg_utxos[p: p + 32], int.from_bytes(msg_utxos[p + 32: p + 34], 'big'))) p += 34 return proof_utxos diff --git a/basicswap/ui/page_offers.py b/basicswap/ui/page_offers.py index 199d487..993e983 100644 --- a/basicswap/ui/page_offers.py +++ b/basicswap/ui/page_offers.py @@ -261,10 +261,14 @@ def postNewOfferFromParsed(swap_client, parsed_data): elif parsed_data['coin_to'] in (Coins.XMR, Coins.PART_ANON): swap_type = SwapTypes.XMR_SWAP - if swap_client.coin_clients[parsed_data['coin_from']]['use_csv'] and swap_client.coin_clients[parsed_data['coin_to']]['use_csv']: + if swap_type == SwapTypes.XMR_SWAP: + # All coins capable of segwit should be capable of csv lock_type = TxLockTypes.SEQUENCE_LOCK_TIME else: - lock_type = TxLockTypes.ABS_LOCK_TIME + if swap_client.coin_clients[parsed_data['coin_from']]['use_csv'] and swap_client.coin_clients[parsed_data['coin_to']]['use_csv']: + lock_type = TxLockTypes.SEQUENCE_LOCK_TIME + else: + lock_type = TxLockTypes.ABS_LOCK_TIME extra_options = {}