From 3234e3fba325a10dded6168c7c4ba949eb2272f8 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Thu, 16 Feb 2023 12:37:16 +0200 Subject: [PATCH] api: Add ability to abandon bids. --- basicswap/js_server.py | 2 ++ tests/basicswap/test_run.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/basicswap/js_server.py b/basicswap/js_server.py index 99dcf57..4941d0f 100644 --- a/basicswap/js_server.py +++ b/basicswap/js_server.py @@ -318,6 +318,8 @@ def js_bids(self, url_split, post_string: str, is_json: bool) -> bytes: post_data = getFormData(post_string, is_json) if have_data_entry(post_data, 'accept'): swap_client.acceptBid(bid_id) + elif have_data_entry(post_data, 'abandon'): + swap_client.abandonBid(bid_id) elif have_data_entry(post_data, 'debugind'): swap_client.setBidDebugInd(bid_id, int(get_data_entry(post_data, 'debugind'))) diff --git a/tests/basicswap/test_run.py b/tests/basicswap/test_run.py index a6396b4..9a146e1 100644 --- a/tests/basicswap/test_run.py +++ b/tests/basicswap/test_run.py @@ -283,7 +283,7 @@ class Test(BaseTest): bid_id = swap_clients[1].postBid(offer_id, offer.amount_from) wait_for_bid(test_delay_event, swap_clients[0], bid_id) - swap_clients[1].abandonBid(bid_id) + read_json_api(1801, 'bids/{}'.format(bid_id.hex()), {'abandon': True}) swap_clients[0].acceptBid(bid_id) wait_for_bid(test_delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)