mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-25 01:53:26 +00:00
Better logs
This commit is contained in:
@ -227,6 +227,7 @@ class Command(BaseCommand):
|
|||||||
try:
|
try:
|
||||||
# It is a maker bond => Publish order.
|
# It is a maker bond => Publish order.
|
||||||
if hasattr(lnpayment, "order_made"):
|
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>")
|
lnpayment.order_made.log("Maker bond <b>locked</b>")
|
||||||
Logics.publish_order(lnpayment.order_made)
|
Logics.publish_order(lnpayment.order_made)
|
||||||
send_notification.delay(
|
send_notification.delay(
|
||||||
@ -238,10 +239,16 @@ class Command(BaseCommand):
|
|||||||
elif hasattr(lnpayment, "take_order"):
|
elif hasattr(lnpayment, "take_order"):
|
||||||
if lnpayment.take_order.order.status == Order.Status.PUB:
|
if lnpayment.take_order.order.status == Order.Status.PUB:
|
||||||
# It there was no other taker already locked => close contract.
|
# 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>")
|
lnpayment.take_order.order.log("Taker bond <b>locked</b>")
|
||||||
Logics.finalize_contract(lnpayment.take_order)
|
Logics.finalize_contract(lnpayment.take_order)
|
||||||
else:
|
else:
|
||||||
# It there was another taker already locked => cancel bond.
|
# 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(
|
lnpayment.take_order.order.log(
|
||||||
"Another taker bond is already locked, <b>Cancelling</b>"
|
"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.
|
# It is a trade escrow => move foward order status.
|
||||||
elif hasattr(lnpayment, "order_escrow"):
|
elif hasattr(lnpayment, "order_escrow"):
|
||||||
|
self.stderr.write("Updating order with new Locked escrow")
|
||||||
lnpayment.order_escrow.log("Trade escrow <b>locked</b>")
|
lnpayment.order_escrow.log("Trade escrow <b>locked</b>")
|
||||||
Logics.trade_escrow_received(lnpayment.order_escrow)
|
Logics.trade_escrow_received(lnpayment.order_escrow)
|
||||||
return
|
return
|
||||||
@ -277,20 +285,24 @@ class Command(BaseCommand):
|
|||||||
# Testing needed for end of time trades!
|
# Testing needed for end of time trades!
|
||||||
elif lnpayment.status == LNPayment.Status.CANCEL:
|
elif lnpayment.status == LNPayment.Status.CANCEL:
|
||||||
if hasattr(lnpayment, "order_made"):
|
if hasattr(lnpayment, "order_made"):
|
||||||
|
self.stderr.write("Expiting order with cancelled payent from maker")
|
||||||
Logics.order_expires(lnpayment.order_made)
|
Logics.order_expires(lnpayment.order_made)
|
||||||
return
|
return
|
||||||
|
|
||||||
elif hasattr(lnpayment, "take_order"):
|
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)
|
Logics.take_order_expires(lnpayment.take_order)
|
||||||
if hasattr(lnpayment, "order_taken"):
|
|
||||||
Logics.order_expires(lnpayment.order_taken)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
elif hasattr(lnpayment, "order_escrow"):
|
elif hasattr(lnpayment, "order_escrow"):
|
||||||
|
self.stderr.write("Expiting order with cancelled escrow")
|
||||||
Logics.order_expires(lnpayment.order_escrow)
|
Logics.order_expires(lnpayment.order_escrow)
|
||||||
return
|
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)
|
Logics.take_order_expires(lnpayment.order_escrow)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user