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