mirror of
https://github.com/RoboSats/robosats.git
synced 2025-02-07 13:59:06 +00:00
Fix clean-orders failure when trade_escrow has not been generated
This commit is contained in:
parent
0b7542bf68
commit
9025b2e07d
@ -234,7 +234,10 @@ class Logics:
|
|||||||
if maker_is_seller:
|
if maker_is_seller:
|
||||||
cls.settle_bond(order.maker_bond)
|
cls.settle_bond(order.maker_bond)
|
||||||
cls.return_bond(order.taker_bond)
|
cls.return_bond(order.taker_bond)
|
||||||
cls.cancel_escrow(order)
|
try: # If seller is offline the escrow LNpayment does not even exist
|
||||||
|
cls.cancel_escrow(order)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
order.status = Order.Status.EXP
|
order.status = Order.Status.EXP
|
||||||
order.save()
|
order.save()
|
||||||
return True
|
return True
|
||||||
@ -242,7 +245,10 @@ class Logics:
|
|||||||
# If maker is buyer, settle the taker's bond order goes back to public
|
# If maker is buyer, settle the taker's bond order goes back to public
|
||||||
else:
|
else:
|
||||||
cls.settle_bond(order.taker_bond)
|
cls.settle_bond(order.taker_bond)
|
||||||
cls.cancel_escrow(order)
|
try: # If seller is offline the escrow LNpayment does not even exist
|
||||||
|
cls.cancel_escrow(order)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
order.taker = None
|
order.taker = None
|
||||||
order.taker_bond = None
|
order.taker_bond = None
|
||||||
order.trade_escrow = None
|
order.trade_escrow = None
|
||||||
|
@ -43,6 +43,8 @@ class Command(BaseCommand):
|
|||||||
debug = {}
|
debug = {}
|
||||||
debug["num_expired_orders"] = len(queryset)
|
debug["num_expired_orders"] = len(queryset)
|
||||||
debug["expired_orders"] = []
|
debug["expired_orders"] = []
|
||||||
|
debug["failed_order_expiry"] = []
|
||||||
|
debug["reason_failure"] = []
|
||||||
|
|
||||||
for idx, order in enumerate(queryset):
|
for idx, order in enumerate(queryset):
|
||||||
context = str(order) + " was " + Order.Status(
|
context = str(order) + " was " + Order.Status(
|
||||||
@ -55,6 +57,9 @@ class Command(BaseCommand):
|
|||||||
# It should not happen, but if it cannot locate the hold invoice
|
# It should not happen, but if it cannot locate the hold invoice
|
||||||
# it probably was cancelled by another thread, make it expire anyway.
|
# it probably was cancelled by another thread, make it expire anyway.
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
debug["failed_order_expiry"].append({idx: context})
|
||||||
|
debug["reason_failure"].append({idx: str(e)})
|
||||||
|
|
||||||
if "unable to locate invoice" in str(e):
|
if "unable to locate invoice" in str(e):
|
||||||
self.stdout.write(str(e))
|
self.stdout.write(str(e))
|
||||||
order.status = Order.Status.EXP
|
order.status = Order.Status.EXP
|
||||||
|
Loading…
Reference in New Issue
Block a user