Add check if attribute order exists when triggering an order status

This commit is contained in:
Reckless_Satoshi 2022-01-18 14:17:41 -08:00
parent 7a6c29fe64
commit 285f85aaf2
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 4 additions and 6 deletions

View File

@ -520,7 +520,6 @@ class Logics():
# Do not gen if a taker invoice exist. Do not return if it is already locked. Return the old one if still waiting.
if order.taker_bond:
# Check if status is INVGEN and still not expired
if cls.is_taker_bond_locked(order):
return False, None
elif order.taker_bond.status == LNPayment.Status.INVGEN:

View File

@ -105,21 +105,20 @@ class Command(BaseCommand):
# If the LNPayment goes to LOCKED (ACCEPTED)
if lnpayment.status == LNPayment.Status.LOCKED:
try:
# It is a maker bond => Publish order.
if not lnpayment.order_made == None:
if hasattr(lnpayment, 'order_made' ):
Logics.publish_order(lnpayment.order_made)
return
# It is a taker bond => close contract.
elif not lnpayment.order_taken == None:
elif hasattr(lnpayment, 'order_taken' ):
if lnpayment.order_taken.status == Order.Status.TAK:
Logics.finalize_contract(lnpayment.order_taken)
return
# It is a trade escrow => move foward order status.
elif not lnpayment.order_escrow == None:
elif hasattr(lnpayment, 'order_escrow' ):
Logics.trade_escrow_received(lnpayment.order_escrow)
return
except Exception as e: