mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Fix order status change must happen exactly when last sats update on contract finalization
This commit is contained in:
parent
1600b58bab
commit
c7a14fbc56
@ -1310,22 +1310,24 @@ class Logics:
|
||||
# (This is the last update to "last_satoshis", it becomes the escrow amount next)
|
||||
order.last_satoshis = cls.satoshis_now(order)
|
||||
order.last_satoshis_time = timezone.now()
|
||||
order.taker_bond.status = LNPayment.Status.LOCKED
|
||||
order.taker_bond.save(update_fields=["status"])
|
||||
|
||||
# With the bond confirmation the order is extended 'public_order_duration' hours
|
||||
order.expires_at = timezone.now() + timedelta(
|
||||
seconds=order.t_to_expire(Order.Status.WF2)
|
||||
)
|
||||
order.update_status(Order.Status.WF2)
|
||||
order.status = Order.Status.WF2
|
||||
order.save(
|
||||
update_fields=[
|
||||
"status",
|
||||
"last_satoshis",
|
||||
"last_satoshis_time",
|
||||
"expires_at",
|
||||
]
|
||||
)
|
||||
|
||||
order.taker_bond.status = LNPayment.Status.LOCKED
|
||||
order.taker_bond.save(update_fields=["status"])
|
||||
|
||||
# Both users robots are added one more contract // Unsafe can add more than once.
|
||||
order.maker.robot.total_contracts += 1
|
||||
order.taker.robot.total_contracts += 1
|
||||
|
12
api/views.py
12
api/views.py
@ -307,7 +307,17 @@ class OrderView(viewsets.ViewSet):
|
||||
data["escrow_locked"] = False
|
||||
|
||||
# If both bonds are locked, participants can see the final trade amount in sats.
|
||||
if order.taker_bond:
|
||||
if order.status in [
|
||||
Order.Status.WF2,
|
||||
Order.Status.WFI,
|
||||
Order.Status.WFE,
|
||||
Order.Status.CCA,
|
||||
Order.Status.FSE,
|
||||
Order.Status.DIS,
|
||||
Order.Status.PAY,
|
||||
Order.Status.SUC,
|
||||
Order.Status.FAI,
|
||||
]:
|
||||
if (
|
||||
order.maker_bond.status
|
||||
== order.taker_bond.status
|
||||
|
Loading…
Reference in New Issue
Block a user