aOnly set reversed flag for ads type swaps.

This commit is contained in:
tecnovert 2023-12-01 14:46:57 +02:00
parent 5b6f447692
commit a4c79fb7aa
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
2 changed files with 6 additions and 4 deletions

View file

@ -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)

View file

@ -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)