Add debug code in Transactions

This commit is contained in:
Mark Veidemanis 2021-12-30 14:15:07 +00:00
parent 44d997ea20
commit 88d3cfba30
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 7 additions and 8 deletions

View File

@ -79,18 +79,14 @@ class Transactions(object):
self.irc.client.channel, f"AUTO Incoming transaction: {amount}{currency} ({reference}) - {state} - {description}" self.irc.client.channel, f"AUTO Incoming transaction: {amount}{currency} ({reference}) - {state} - {description}"
) )
# Try getting the trade by the reference ID given # Try getting the trade by the reference ID given
print("REFERENCE", reference)
stored_trade = self.get_ref(reference) stored_trade = self.get_ref(reference)
print(f"STORED_TRADE {stored_trade}")
if not stored_trade: if not stored_trade:
print(f"NOT STORED TRADE {reference}")
self.log.info(f"No reference in DB for {reference}", reference=reference) self.log.info(f"No reference in DB for {reference}", reference=reference)
self.irc.client.msg(self.irc.client.channel, f"No reference in DB for {reference}") self.irc.client.msg(self.irc.client.channel, f"No reference in DB for {reference}")
# Try getting the trade by the reference, using it as a TXID
ref2 = self.tx_to_ref(reference)
if not ref2:
self.log.info("No TXID in DB for {reference}", reference=reference)
self.irc.client.msg(self.irc.client.channel, f"No TXID in DB for {reference}")
return return
else:
reference = ref2
amount = float(amount) amount = float(amount)
stored_trade["amount"] = float(stored_trade["amount"]) stored_trade["amount"] = float(stored_trade["amount"])
@ -202,7 +198,10 @@ class Transactions(object):
:return: trade ID :return: trade ID
:rtype: string :rtype: string
""" """
ref_data = convert(r.hgetall(f"trade.{reference}")) ref_data = r.hgetall(f"trade.{reference}")
print(f"RETURN FROM GET_REF() {ref_data}")
ref_data = convert(ref_data)
print(f"CONVERTED IN GET_REF() {ref_data}")
if not ref_data: if not ref_data:
return False return False
return ref_data return ref_data