Better logs

This commit is contained in:
koalasat
2025-03-01 23:52:30 +01:00
parent 4f8139bb01
commit 0a8d648fa4

View File

@ -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 <b>locked</b>")
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 <b>locked</b>")
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, <b>Cancelling</b>"
)
@ -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 <b>locked</b>")
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