Use the right variable to check amount

This commit is contained in:
Mark Veidemanis 2022-01-01 20:01:01 +00:00
parent 5ea1c26a84
commit bc68bcd74f
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 8 additions and 1 deletions

View File

@ -114,12 +114,19 @@ class Transactions(object):
) )
self.irc.sendmsg(f"Failed to get reference by amount and currency: {txid} {currency} {amount}") self.irc.sendmsg(f"Failed to get reference by amount and currency: {txid} {currency} {amount}")
return 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.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") 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 # Close here if the amount exceeds the allowable limit for no reference
return return
# Note that we have looked it up without reference so we don't use +- below # 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 looked_up_without_reference = True
if not stored_trade: if not stored_trade:
stored_trade = self.get_ref(stored_trade_reference.pop()) stored_trade = self.get_ref(stored_trade_reference.pop())