From bc68bcd74f8e5456d7e6b95c72b029bd1eb497be Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 1 Jan 2022 20:01:01 +0000 Subject: [PATCH] Use the right variable to check amount --- handler/transactions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/handler/transactions.py b/handler/transactions.py index 1279ceb..0be9144 100644 --- a/handler/transactions.py +++ b/handler/transactions.py @@ -114,12 +114,19 @@ class Transactions(object): ) self.irc.sendmsg(f"Failed to get reference by amount and currency: {txid} {currency} {amount}") return - if amount > settings.Agora.AcceptableAltLookupUSD: + if currency == "USD": + amount_usd = amount + else: + rates = self.get_rates_all() + amount_usd = amount / rates[currency] + # Amount is reliable here as it is checked by find_trade, so no need for stored_trade["amount"] + if amount_usd > settings.Agora.AcceptableAltLookupUSD: self.log.info("Not checking against amount and currency as amount exceeds MAX") self.irc.sendmsg(f"Not checking against amount and currency as amount exceeds MAX") # Close here if the amount exceeds the allowable limit for no reference return # Note that we have looked it up without reference so we don't use +- below + # This might be redundant given the amount checks in find_trade, but better safe than sorry! looked_up_without_reference = True if not stored_trade: stored_trade = self.get_ref(stored_trade_reference.pop())