Add extra debugging in transactions

master
Mark Veidemanis 3 years ago
parent d000f75ca2
commit e91916b18b
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -40,29 +40,36 @@ class Transactions(object):
if "type" not in inside:
stored_trade = r.hgetall(f"tx.{txid}")
print("stored trade", stored_trade)
if not stored_trade:
self.log.error("Could not find entry in DB for typeless transaction: {id}", id=txid)
return
stored_trade = convert(stored_trade)
print("stored trade", stored_trade)
print("received event", dumps(data, indent=2))
if "old_state" in inside:
print("Old state is inside")
if "new_state" in inside:
print("New state is inside")
# We don't care unless we're being told a transaction is now completed
if not inside["new_state"] == "completed":
print("New state is note completed, aborting")
return
# We don't care unless the existing trade is pending
if not stored_trade["state"] == "pending":
print("State is not pending, aborting")
return
# Check the old state is what we also think it is
if inside["old_state"] == stored_trade["state"]:
print("Old state is the state we think it should be")
# Set the state to the new state
stored_trade["state"] = inside["new_state"]
# Store the updated state
r.hmset(f"tx.{txid}", stored_trade)
# Check it's all been previously validated
if "valid" not in stored_trade:
print("Valid not in stored trade")
print("valid not in stored_trade", stored_trade)
if stored_trade["valid"] == 1:
if stored_trade["valid"] == "1":
print("WOULD RELEASE ESCROW FROM SECONDARY NOTINSIDE UPDATE", stored_trade["trade_id"], stored_trade["txid"])
return
# If type not in inside and we haven't hit any more returns

Loading…
Cancel
Save