Fix adaptor sig swaps to Firo.

This commit is contained in:
tecnovert
2025-05-13 21:59:02 +02:00
parent f6914d7c30
commit 13847e129b
7 changed files with 52 additions and 8 deletions

View File

@@ -79,6 +79,7 @@ class BCHInterface(BTCInterface):
self.rpc_wallet = make_rpc_func(
self._rpcport, self._rpcauth, host=self._rpc_host
)
self.rpc_wallet_watch = self.rpc_wallet
def has_segwit(self) -> bool:
# bch does not have segwit, but we return true here to avoid extra checks in basicswap.py

View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2022-2023 tecnovert
# Copyright (c) 2024 The Basicswap developers
# Copyright (c) 2024-2025 The Basicswap developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
@@ -44,6 +44,7 @@ class FIROInterface(BTCInterface):
self.rpc_wallet = make_rpc_func(
self._rpcport, self._rpcauth, host=self._rpc_host
)
self.rpc_wallet_watch = self.rpc_wallet
if "wallet_name" in coin_settings:
raise ValueError(f"Invalid setting for {self.coin_name()}: wallet_name")

View File

@@ -98,6 +98,7 @@ class LTCInterfaceMWEB(LTCInterface):
self.rpc_wallet = make_rpc_func(
self._rpcport, self._rpcauth, host=self._rpc_host, wallet=self._rpc_wallet
)
self.rpc_wallet_watch = self.rpc_wallet
def chainparams(self):
return chainparams[Coins.LTC]

View File

@@ -79,6 +79,7 @@ class NAVInterface(BTCInterface):
self.rpc_wallet = make_rpc_func(
self._rpcport, self._rpcauth, host=self._rpc_host
)
self.rpc_wallet_watch = self.rpc_wallet
if "wallet_name" in coin_settings:
raise ValueError(f"Invalid setting for {self.coin_name()}: wallet_name")

View File

@@ -209,6 +209,15 @@ class PARTInterfaceBlind(PARTInterface):
def xmr_swap_b_lock_spend_tx_vsize() -> int:
return 980
@staticmethod
def compareFeeRates(actual: int, expected: int) -> bool:
# Allow the fee to be up to 10% larger than expected
if actual < expected - 20:
return False
if actual > expected + expected * 0.1:
return False
return True
def coin_name(self) -> str:
return super().coin_name() + " Blind"
@@ -678,6 +687,7 @@ class PARTInterfaceBlind(PARTInterface):
witness_bytes = self.getWitnessStackSerialisedLength(dummy_witness_stack)
vsize = self.getTxVSize(self.loadTx(tx_bytes), add_witness_bytes=witness_bytes)
fee_paid = self.make_int(lock_refund_spend_tx_obj["vout"][0]["ct_fee"])
fee_rate_paid = fee_paid * 1000 // vsize
ensure(
self.compareFeeRates(fee_rate_paid, feerate),

View File

@@ -33,6 +33,7 @@ class PIVXInterface(BTCInterface):
self.rpc_wallet = make_rpc_func(
self._rpcport, self._rpcauth, host=self._rpc_host
)
self.rpc_wallet_watch = self.rpc_wallet
def encryptWallet(self, password: str, check_seed: bool = True):
# Watchonly wallets are not encrypted