Settle bonds at dispute opening. Avoids channel force closure in long resolution disputes.

This commit is contained in:
Reckless_Satoshi 2022-02-20 03:39:28 -08:00
parent 03bfc487ea
commit 23eabffeca
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -299,11 +299,15 @@ class Logics:
@classmethod
def open_dispute(cls, order, user=None):
# Always settle the escrow during a dispute
# Dispute winner will have to submit a new invoice.
# Always settle escro and bonds during a dispute. Disputes
# can take long to resolve, it might trigger force closure
# for unresolve HTLCs) Dispute winner will have to submit a
# new invoice for value of escrow + bond.
if not order.trade_escrow.status == LNPayment.Status.SETLED:
cls.settle_escrow(order)
cls.settle_bond(order.maker_bond)
cls.settle_bond(order.taker_bond)
order.is_disputed = True
order.status = Order.Status.DIS