Add retry time and lnpayment properties for routing failure

This commit is contained in:
Reckless_Satoshi 2022-01-23 13:12:30 -08:00
parent 8919b7937b
commit be5b32c451
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,8 @@ FEE = 0.002
BOND_SIZE = 0.01
# Time out penalty for canceling takers in SECONDS
PENALTY_TIMEOUT = 60
# Time between routing attempts of buyer invoice in MINUTES
RETRY_TIME = 5
# Trade limits in satoshis
MIN_TRADE = 10000

View File

@ -26,6 +26,7 @@ from decouple import config
EXP_MAKER_BOND_INVOICE = int(config('EXP_MAKER_BOND_INVOICE'))
FEE = float(config('FEE'))
RETRY_TIME = int(config('RETRY_TIME'))
avatar_path = Path('frontend/static/assets/avatars')
avatar_path.mkdir(parents=True, exist_ok=True)
@ -230,6 +231,11 @@ class OrderView(viewsets.ViewSet):
data['statement_submitted'] = (order.maker_statement != None and order.maker_statement != "")
elif data['is_taker']:
data['statement_submitted'] = (order.taker_statement != None and order.maker_statement != "")
# 9) If status is 'Failed routing', reply with retry amounts, time of next retry and ask for invoice at third.
elif order.status == Order.Status.FAI:
data['retries'] = order.buyer_invoice.routing_attempts
data['next_retry_time'] = order.buyer_invoice.last_routing_time + timedelta(minutes=RETRY_TIME)
return Response(data, status.HTTP_200_OK)