mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
Test BCH mercy tx in reverse swaps.
This commit is contained in:
@@ -141,7 +141,7 @@ def wait_for_bid(delay_event, swap_client, bid_id, state=None, sent: bool = Fals
|
||||
assert (len(bids) < 2)
|
||||
for bid in bids:
|
||||
if bid[2] == bid_id:
|
||||
if isinstance(state, list):
|
||||
if isinstance(state, (list, tuple)):
|
||||
if bid[5] in state:
|
||||
return
|
||||
else:
|
||||
|
||||
@@ -568,7 +568,8 @@ class TestBCH(BasicSwapTest):
|
||||
|
||||
def test_03_b_follower_recover_a_lock_tx_reverse(self):
|
||||
self.prepare_balance(Coins.BCH, 100.0, 1801, 1800)
|
||||
super().test_03_b_follower_recover_a_lock_tx_reverse()
|
||||
self.prepare_balance(Coins.XMR, 100.0, 1800, 1801)
|
||||
self.do_test_03_follower_recover_a_lock_tx(Coins.XMR, self.test_coin_from, lock_value=12, with_mercy=True)
|
||||
|
||||
def test_03_c_follower_recover_a_lock_tx_to_part(self):
|
||||
super().test_03_c_follower_recover_a_lock_tx_to_part()
|
||||
|
||||
@@ -296,16 +296,19 @@ class TestFunctions(BaseTest):
|
||||
bid_id = swap_clients[id_bidder].postXmrBid(offer_id, offer.amount_from)
|
||||
wait_for_bid(test_delay_event, swap_clients[id_offerer], bid_id, BidStates.BID_RECEIVED)
|
||||
|
||||
debug_type = DebugTypes.BID_DONT_SPEND_COIN_B_LOCK if with_mercy else DebugTypes.BID_STOP_AFTER_COIN_A_LOCK
|
||||
swap_clients[id_follower].setBidDebugInd(bid_id, debug_type)
|
||||
debug_type = DebugTypes.BID_DONT_SPEND_COIN_A_LOCK_REFUND2 if with_mercy else DebugTypes.BID_DONT_SPEND_COIN_A_LOCK_REFUND
|
||||
swap_clients[id_leader].setBidDebugInd(bid_id, debug_type)
|
||||
debug_type = DebugTypes.BID_DONT_SPEND_COIN_B_LOCK if with_mercy else DebugTypes.BID_STOP_AFTER_COIN_A_LOCK
|
||||
swap_clients[id_follower].setBidDebugInd(bid_id, debug_type)
|
||||
|
||||
swap_clients[id_leader].setBidDebugInd(bid_id, DebugTypes.WAIT_FOR_COIN_B_LOCK_BEFORE_REFUND, False)
|
||||
swap_clients[id_follower].setBidDebugInd(bid_id, DebugTypes.WAIT_FOR_COIN_B_LOCK_BEFORE_REFUND, False)
|
||||
|
||||
swap_clients[id_offerer].acceptBid(bid_id)
|
||||
|
||||
leader_sent_bid: bool = True if reverse_bid else False
|
||||
|
||||
expect_state = BidStates.XMR_SWAP_NOSCRIPT_TX_REDEEMED if with_mercy else BidStates.BID_STALLED_FOR_TEST
|
||||
expect_state = (BidStates.XMR_SWAP_NOSCRIPT_TX_REDEEMED, BidStates.SWAP_COMPLETED) if with_mercy else BidStates.BID_STALLED_FOR_TEST
|
||||
wait_for_bid(test_delay_event, swap_clients[id_leader], bid_id, expect_state, wait_for=(self.extra_wait_time + 180), sent=leader_sent_bid)
|
||||
wait_for_bid(test_delay_event, swap_clients[id_follower], bid_id, BidStates.XMR_SWAP_FAILED_SWIPED, wait_for=(self.extra_wait_time + 80), sent=(not leader_sent_bid))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user