diff --git a/api/management/commands/follow_invoices.py b/api/management/commands/follow_invoices.py index c8f79c37..41e583b6 100644 --- a/api/management/commands/follow_invoices.py +++ b/api/management/commands/follow_invoices.py @@ -227,6 +227,7 @@ class Command(BaseCommand): try: # It is a maker bond => Publish order. if hasattr(lnpayment, "order_made"): + self.stderr.write("Updating order with new Locked bond from maker") lnpayment.order_made.log("Maker bond locked") Logics.publish_order(lnpayment.order_made) send_notification.delay( @@ -238,10 +239,16 @@ class Command(BaseCommand): elif hasattr(lnpayment, "take_order"): if lnpayment.take_order.order.status == Order.Status.PUB: # It there was no other taker already locked => close contract. + self.stderr.write( + "Updating order with new Locked bond from taker" + ) lnpayment.take_order.order.log("Taker bond locked") Logics.finalize_contract(lnpayment.take_order) else: # It there was another taker already locked => cancel bond. + self.stderr.write( + "Expiring take_order because order was already taken" + ) lnpayment.take_order.order.log( "Another taker bond is already locked, Cancelling" ) @@ -251,6 +258,7 @@ class Command(BaseCommand): # It is a trade escrow => move foward order status. elif hasattr(lnpayment, "order_escrow"): + self.stderr.write("Updating order with new Locked escrow") lnpayment.order_escrow.log("Trade escrow locked") Logics.trade_escrow_received(lnpayment.order_escrow) return @@ -277,20 +285,24 @@ class Command(BaseCommand): # Testing needed for end of time trades! elif lnpayment.status == LNPayment.Status.CANCEL: if hasattr(lnpayment, "order_made"): + self.stderr.write("Expiting order with cancelled payent from maker") Logics.order_expires(lnpayment.order_made) return elif hasattr(lnpayment, "take_order"): + self.stderr.write( + "Expiting order and take orders with cancelled payent from taker" + ) Logics.take_order_expires(lnpayment.take_order) - if hasattr(lnpayment, "order_taken"): - Logics.order_expires(lnpayment.order_taken) return elif hasattr(lnpayment, "order_escrow"): + self.stderr.write("Expiting order with cancelled escrow") Logics.order_expires(lnpayment.order_escrow) return - elif hasattr(lnpayment, "take_order"): + elif hasattr(lnpayment, "order_taken"): + self.stderr.write("Expiting take order with cancelled escrow") Logics.take_order_expires(lnpayment.order_escrow) return