tests: Improve test_02_leader_recover_a_lock_tx

This commit is contained in:
tecnovert
2025-01-13 21:15:30 +02:00
parent 3cea5449c9
commit 159974d414
3 changed files with 32 additions and 4 deletions

View File

@@ -148,7 +148,7 @@ def stopDaemons(daemons):
def wait_for_bid(
delay_event, swap_client, bid_id, state=None, sent: bool = False, wait_for: int = 20
) -> None:
logging.info("wait_for_bid %s", bid_id.hex())
swap_client.log.debug(f"TEST: wait_for_bid {bid_id.hex()}")
for i in range(wait_for):
if delay_event.is_set():
raise ValueError("Test stopped.")
@@ -161,6 +161,10 @@ def wait_for_bid(
assert len(bids) < 2
for bid in bids:
if bid[2] == bid_id:
if i > 0 and i % 10 == 0:
swap_client.log.debug(
f"TEST: wait_for_bid {bid_id.hex()}: Bid state {bid[5]}, target {state}."
)
if isinstance(state, (list, tuple)):
if bid[5] in state:
return
@@ -169,6 +173,11 @@ def wait_for_bid(
elif state is not None and state != bid[5]:
continue
return
else:
if i > 0 and i % 10 == 0:
swap_client.log.debug(
f"TEST: wait_for_bid {bid_id.hex()}: Bid not found."
)
raise ValueError("wait_for_bid timed out.")

View File

@@ -1503,7 +1503,7 @@ class Test(BaseTest):
101 * COIN,
SwapTypes.XMR_SWAP,
lock_type=TxLockTypes.SEQUENCE_LOCK_BLOCKS,
lock_value=12,
lock_value=16,
)
wait_for_offer(test_delay_event, swap_clients[1], offer_id)
offer = swap_clients[1].getOffer(offer_id)
@@ -1522,6 +1522,9 @@ class Test(BaseTest):
assert xmr_swap
swap_clients[1].setBidDebugInd(bid_id, DebugTypes.BID_STOP_AFTER_COIN_A_LOCK)
swap_clients[1].setBidDebugInd(
bid_id, DebugTypes.BID_DONT_SPEND_COIN_A_LOCK_REFUND2, False
)
swap_clients[0].acceptXmrBid(bid_id)