Small fixes

This commit is contained in:
Reckless_Satoshi 2022-02-06 06:50:42 -08:00
parent 1a6aa8a9ee
commit db2d7cc922
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
3 changed files with 8 additions and 19 deletions

View File

@ -122,22 +122,11 @@ class LNNode():
lnpayment.save() lnpayment.save()
return True return True
# @classmethod @classmethod
# def check_until_invoice_locked(cls, payment_hash, expiration): def resetmc(cls):
# '''Checks until hold invoice is locked. request = routerrpc.ResetMissionControlRequest()
# When invoice is locked, returns true. response = cls.routerstub.ResetMissionControl(request, metadata=[('macaroon', MACAROON.hex())])
# If time expires, return False.''' return True
# # Experimental, might need asyncio. Best if subscribing all invoices and running a background task
# # Maybe best to pass LNpayment object and change status live.
# request = invoicesrpc.SubscribeSingleInvoiceRequest(r_hash=payment_hash)
# for invoice in cls.invoicesstub.SubscribeSingleInvoice(request):
# print(invoice)
# if timezone.now > expiration:
# break
# if invoice.state == 3: # True if hold invoice is accepted.
# return True
# return False
@classmethod @classmethod

View File

@ -129,7 +129,7 @@ class Command(BaseCommand):
queryset_retries = LNPayment.objects.filter(type=LNPayment.Types.NORM, queryset_retries = LNPayment.objects.filter(type=LNPayment.Types.NORM,
status__in=[LNPayment.Status.VALIDI, LNPayment.Status.FAILRO], status__in=[LNPayment.Status.VALIDI, LNPayment.Status.FAILRO],
routing_attempts__lt=4, routing_attempts__lt=5,
last_routing_time__lt=(timezone.now()-timedelta(minutes=int(config('RETRY_TIME'))))) last_routing_time__lt=(timezone.now()-timedelta(minutes=int(config('RETRY_TIME')))))
queryset = queryset.union(queryset_retries) queryset = queryset.union(queryset_retries)
@ -142,7 +142,7 @@ class Command(BaseCommand):
LNNode.resetmc() LNNode.resetmc()
# If already 3 attempts and last failed. Make it expire (ask for a new invoice) an reset attempts. # If already 3 attempts and last failed. Make it expire (ask for a new invoice) an reset attempts.
if not success and lnpayment.routing_attempts == 3: if not success and lnpayment.routing_attempts > 2:
lnpayment.status = LNPayment.Status.EXPIRE lnpayment.status = LNPayment.Status.EXPIRE
lnpayment.routing_attempts = 0 lnpayment.routing_attempts = 0
lnpayment.save() lnpayment.save()

View File

@ -775,7 +775,7 @@ handleRatingRobosatsChange=(e)=>{
</Grid> </Grid>
<Grid item xs={12} align="center"> <Grid item xs={12} align="center">
<Typography component="body2" variant="body2" align="center"> <Typography component="body2" variant="body2" align="center">
Your invoice has expires or more than 3 payments have been attempted. Your invoice has expires or more than 3 payments attempts have been made.
</Typography> </Typography>
</Grid> </Grid>
<Grid item xs={12} align="center"> <Grid item xs={12} align="center">