test: fix Dash tests

This commit is contained in:
tecnovert
2026-06-06 20:45:01 +02:00
parent 7655f1ad81
commit 554d362a45
21 changed files with 95 additions and 93 deletions
+7 -8
View File
@@ -5552,8 +5552,8 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
use_cursor = self.openDB(cursor)
bid, offer = self.getBidAndOffer(bid_id, use_cursor)
ensure(bid, "Bid not found")
ensure(offer, "Offer not found")
ensure(bid, f"Bid not found: {self.log.id(bid_id)}.")
ensure(offer, f"Offer not found: {self.log.id(bid.offer_id)}.")
# Ensure bid is still valid
now: int = self.getTime()
@@ -6828,8 +6828,8 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
try:
use_cursor = self.openDB(cursor)
bid, offer = self.getBidAndOffer(bid_id, use_cursor, with_txns=False)
ensure(bid, "Bid not found")
ensure(offer, "Offer not found")
ensure(bid, f"Bid not found: {self.log.id(bid_id)}.")
ensure(offer, f"Offer not found: {self.log.id(bid.offer_id)}.")
bid.setState(new_state)
self.deactivateBid(use_cursor, offer, bid)
@@ -13018,8 +13018,8 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
self.log.info(f"Route established for bid {self.log.id(bid_id)}")
bid, offer = self.getBidAndOffer(bid_id, cursor)
ensure(bid, "Bid not found")
ensure(offer, "Offer not found")
ensure(bid, f"Bid not found: {self.log.id(bid_id)}.")
ensure(offer, f"Offer not found: {self.log.id(bid.offer_id)}.")
coin_from = Coins(offer.coin_from)
coin_to = Coins(offer.coin_to)
@@ -15133,8 +15133,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
return
bid = self.getBid(bid_id)
if bid is None:
raise ValueError("Bid not found.")
ensure(bid, f"Bid not found: {self.log.id(bid_id)}.")
bid.debug_ind = debug_ind
+2 -2
View File
@@ -3667,7 +3667,7 @@ class BTCInterface(FeeValidator, Secp256k1Interface):
continue
if "desc" in u:
desc = u["desc"]
if self.using_segwit:
if self.using_segwit():
if self.use_p2shp2wsh():
if not desc.startswith("sh(wpkh"):
continue
@@ -3828,7 +3828,7 @@ class BTCInterface(FeeValidator, Secp256k1Interface):
ensure(
sign_for_addr is not None,
"Could not find address with enough funds for proof",
f"Could not find {self.ticker()} address with enough funds for proof",
)
self._log.debug(f"sign_for_addr {sign_for_addr}")
+1 -1
View File
@@ -102,7 +102,7 @@ class LTCInterface(BTCInterface):
continue
if "desc" in u:
desc = u["desc"]
if self.using_segwit:
if self.using_segwit():
if self.use_p2shp2wsh():
if not desc.startswith("sh(wpkh"):
continue
+10
View File
@@ -170,3 +170,13 @@ class PIVXInterface(BTCInterface):
block_height = self.getBlockHeader(rv["blockhash"])["height"]
return {"txid": txid_hex, "amount": 0, "height": block_height}
return None
def getChainMedianTime(self) -> int:
bestblockhash = self.rpc("getbestblockhash")
bestblockheader = self.rpc(
"getblockheader",
[
bestblockhash,
],
)
return bestblockheader["mediantime"]
+9 -6
View File
@@ -50,11 +50,11 @@ def recoverNoScriptTxnWithKey(self, bid_id: bytes, encoded_key, cursor=None):
try:
use_cursor = self.openDB(cursor)
bid, xmr_swap = self.getXmrBidFromSession(use_cursor, bid_id)
ensure(bid, "Bid not found: {}.".format(bid_id.hex()))
ensure(xmr_swap, "Adaptor-sig swap not found: {}.".format(bid_id.hex()))
ensure(bid, f"Bid not found: {self.log.id(bid_id)}.")
ensure(xmr_swap, f"Adaptor-sig swap not found: {self.log.id(bid_id)}.")
offer, xmr_offer = self.getXmrOfferFromSession(use_cursor, bid.offer_id)
ensure(offer, "Offer not found: {}.".format(bid.offer_id.hex()))
ensure(xmr_offer, "Adaptor-sig offer not found: {}.".format(bid.offer_id.hex()))
ensure(offer, f"Offer not found: {self.log.id(bid.offer_id)}.")
ensure(xmr_offer, f"Adaptor-sig offer not found: {self.log.id(bid.offer_id)}.")
# The no-script coin is always the follower
reverse_bid: bool = self.is_reverse_ads_bid(offer.coin_from, offer.coin_to)
@@ -106,7 +106,10 @@ def recoverNoScriptTxnWithKey(self, bid_id: bytes, encoded_key, cursor=None):
address_to = self.getReceiveAddressFromPool(
base_coin_to, bid_id, TxTypes.XMR_SWAP_B_LOCK_SPEND, use_cursor
)
amount = bid.amount_to
amount: int = bid.amount_to
chain_b_fee_rate: int = (
xmr_offer.a_fee_rate if reverse_bid else xmr_offer.b_fee_rate
)
lock_tx_vout = bid.getLockTXBVout()
txid = ci_follower.spendBLockTx(
xmr_swap.b_lock_tx_id,
@@ -114,7 +117,7 @@ def recoverNoScriptTxnWithKey(self, bid_id: bytes, encoded_key, cursor=None):
xmr_swap.vkbv,
vkbs,
amount,
xmr_offer.b_fee_rate,
chain_b_fee_rate,
bid.chain_b_height_start,
spend_actual_balance=True,
lock_tx_vout=lock_tx_vout,