From a4c79fb7aac2986dd2a4b6798ac1ab70d5894cd5 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Fri, 1 Dec 2023 14:46:57 +0200 Subject: [PATCH] aOnly set reversed flag for ads type swaps. --- basicswap/basicswap.py | 6 ++++-- basicswap/ui/page_offers.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 20c2a81..4bb17db 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -1523,6 +1523,7 @@ class BasicSwap(BaseApp): if security_token is not None and len(security_token) != 20: raise ValueError('Security token must be 20 bytes long.') + bid_reversed: bool = msg_buf.swap_type == SwapTypes.XMR_SWAP and self.is_reverse_ads_bid(msg_buf.coin_from) session = scoped_session(self.session_factory) offer = Offer( offer_id=offer_id, @@ -1546,7 +1547,7 @@ class BasicSwap(BaseApp): created_at=offer_created_at, expire_at=offer_created_at + msg_buf.time_valid, was_sent=True, - bid_reversed=self.is_reverse_ads_bid(msg_buf.coin_from), + bid_reversed=bid_reversed, security_token=security_token) offer.setState(OfferStates.OFFER_SENT) @@ -4410,6 +4411,7 @@ class BasicSwap(BaseApp): # Check for sent existing_offer = self.getOffer(offer_id) if existing_offer is None: + bid_reversed: bool = offer_data.swap_type == SwapTypes.XMR_SWAP and self.is_reverse_ads_bid(offer_data.coin_from) offer = Offer( offer_id=offer_id, active_ind=1, @@ -4432,7 +4434,7 @@ class BasicSwap(BaseApp): created_at=msg['sent'], expire_at=msg['sent'] + offer_data.time_valid, was_sent=False, - bid_reversed=self.is_reverse_ads_bid(offer_data.coin_from)) + bid_reversed=bid_reversed) offer.setState(OfferStates.OFFER_RECEIVED) session.add(offer) diff --git a/basicswap/ui/page_offers.py b/basicswap/ui/page_offers.py index b3ff325..a8aee64 100644 --- a/basicswap/ui/page_offers.py +++ b/basicswap/ui/page_offers.py @@ -488,7 +488,7 @@ def page_offer(self, url_split, post_string): ci_from = swap_client.ci(Coins(offer.coin_from)) ci_to = swap_client.ci(Coins(offer.coin_to)) - reverse_bid: bool = swap_client.is_reverse_ads_bid(offer.coin_from) + reverse_bid: bool = True if offer.bid_reversed else False # Set defaults debugind = -1 @@ -590,7 +590,7 @@ def page_offer(self, url_split, post_string): 'is_expired': offer.expire_at <= now, 'active_ind': offer.active_ind, 'swap_type': strSwapDesc(offer.swap_type), - 'reverse': offer.bid_reversed + 'reverse': reverse_bid, } data.update(extend_data)