diff --git a/gui/templates/channel.html b/gui/templates/channel.html index 62601208..63a2003f 100644 --- a/gui/templates/channel.html +++ b/gui/templates/channel.html @@ -280,7 +280,7 @@

Last 5 Payments Sent

{% for payment in payments %} {{ payment.creation_date|naturaltime }} - {{ payment.payment_hash }} + {{ payment.payment_hash }} {{ payment.value|add:"0"|intcomma }} {{ payment.fee|intcomma }} {{ payment.ppm|intcomma }} @@ -313,7 +313,7 @@

Last 5 Payments Received

{{ invoice.creation_date|naturaltime }} {% if invoice.state == 1 %}{{ invoice.settle_date|naturaltime }}{% else %}---{% endif %} - {{ invoice.r_hash }} + {{ invoice.r_hash }} {{ invoice.value|add:"0"|intcomma }} {% if invoice.state == 1 %}{{ invoice.amt_paid|intcomma }}{% else %}---{% endif %} {% if invoice.state == 0 %}Open{% elif invoice.state == 1 %}Settled{% elif invoice.state == 2 %}Canceled{% else %}{{ invoice.state }}{% endif %} diff --git a/gui/templates/home.html b/gui/templates/home.html index 0c0ebcd6..1d4345d1 100644 --- a/gui/templates/home.html +++ b/gui/templates/home.html @@ -491,7 +491,7 @@

Last 5 Payments Sent

{% for payment in payments %} {{ payment.creation_date|naturaltime }} - {{ payment.payment_hash }} + {{ payment.payment_hash }} {{ payment.value|add:"0"|intcomma }} {{ payment.fee|intcomma }} {{ payment.ppm|intcomma }} @@ -524,7 +524,7 @@

Last 5 Payments Received

{{ invoice.creation_date|naturaltime }} {% if invoice.state == 1 %}{{ invoice.settle_date|naturaltime }}{% else %}---{% endif %} - {{ invoice.r_hash }} + {{ invoice.r_hash }} {{ invoice.value|add:"0"|intcomma }} {% if invoice.state == 1 %}{{ invoice.amt_paid|intcomma }}{% else %}---{% endif %} {% if invoice.state == 0 %}Open{% elif invoice.state == 1 %}Settled{% elif invoice.state == 2 %}Canceled{% else %}{{ invoice.state }}{% endif %} diff --git a/gui/templates/invoices.html b/gui/templates/invoices.html index fa799aa2..08109181 100644 --- a/gui/templates/invoices.html +++ b/gui/templates/invoices.html @@ -21,7 +21,7 @@

Last 150 Invoices

{{ invoice.creation_date|naturaltime }} {% if invoice.state == 1 %}{{ invoice.settle_date|naturaltime }}{% else %}---{% endif %} - {{ invoice.r_hash }} +
{{ invoice.r_hash }} {{ invoice.value|add:"0"|intcomma }} {% if invoice.state == 1 %}{{ invoice.amt_paid|intcomma }}{% else %}---{% endif %} {% if invoice.state == 0 %}Open{% elif invoice.state == 1 %}Settled{% elif invoice.state == 2 %}Canceled{% else %}{{ invoice.state }}{% endif %} diff --git a/gui/templates/payments.html b/gui/templates/payments.html index bf7ad3de..42f0f244 100644 --- a/gui/templates/payments.html +++ b/gui/templates/payments.html @@ -21,7 +21,7 @@

Last 150 Payments

{% for payment in payments %} {{ payment.creation_date|naturaltime }} - {{ payment.payment_hash }} +
{{ payment.payment_hash }} {{ payment.value|add:"0"|intcomma }} {{ payment.fee|intcomma }} {{ payment.ppm|intcomma }} diff --git a/gui/templates/pending_htlcs.html b/gui/templates/pending_htlcs.html index babce0e5..b32b572a 100644 --- a/gui/templates/pending_htlcs.html +++ b/gui/templates/pending_htlcs.html @@ -23,7 +23,7 @@

Outgoing HTLCs

{% if htlc.forwarding_alias == '' %}---{% else %}{{ htlc.forwarding_alias }}{% endif %} {{ htlc.amount|intcomma }} {{ htlc.hours_til_expiration }} hours - {{ htlc.hash_lock }} +
{{ htlc.hash_lock }} {% endfor %} @@ -50,7 +50,7 @@

Incoming HTLCs

{% if htlc.forwarding_alias == '' %}---{% else %}{{ htlc.forwarding_alias }}{% endif %} {{ htlc.amount|intcomma }} {{ htlc.hours_til_expiration }} hours - {{ htlc.hash_lock }} + {{ htlc.hash_lock }} {% endfor %} diff --git a/gui/views.py b/gui/views.py index 68540294..30dcea93 100644 --- a/gui/views.py +++ b/gui/views.py @@ -1259,7 +1259,14 @@ def channel(request): 'graph_links': graph_links(), 'network_links': network_links() } - return render(request, 'channel.html', context) + try: + return render(request, 'channel.html', context) + except Exception as e: + try: + error = str(e.code()) + except: + error = str(e) + return render(request, 'error.html', {'error': error}) else: return redirect('home') @@ -1369,7 +1376,7 @@ def failed_htlcs(request): def payments(request): if request.method == 'GET': context = { - 'payments': Payments.objects.filter(status=2).annotate(ppm=Round((Sum('fee')*1000000)/Sum('value'), output_field=IntegerField())).order_by('-creation_date')[:150], + 'payments': Payments.objects.exclude(status=3).annotate(ppm=Round((Sum('fee')*1000000)/Sum('value'), output_field=IntegerField())).order_by('-creation_date')[:150], } return render(request, 'payments.html', context) else: diff --git a/jobs.py b/jobs.py index 92fcaf89..5fab6a41 100644 --- a/jobs.py +++ b/jobs.py @@ -20,7 +20,8 @@ def update_payments(stub): inflight_payments = Payments.objects.filter(status=1).order_by('index') for payment in inflight_payments: payment_data = stub.ListPayments(ln.ListPaymentsRequest(include_incomplete=True, index_offset=payment.index-1, max_payments=1)).payments - if len(payment_data) > 0 and payment.payment_hash == payment_data[0].payment_hash: + #Ignore inflight payments before 30 days + if len(payment_data) > 0 and payment.payment_hash == payment_data[0].payment_hash and payment.creation_date > (datetime.now() - timedelta(days=30)): update_payment(stub, payment_data[0], self_pubkey) else: payment.status = 3 @@ -31,9 +32,9 @@ def update_payments(stub): try: new_payment = Payments(creation_date=datetime.fromtimestamp(payment.creation_date), payment_hash=payment.payment_hash, value=round(payment.value_msat/1000, 3), fee=round(payment.fee_msat/1000, 3), status=payment.status, index=payment.payment_index) new_payment.save() - if payment.status == 2: + if payment.status == 2 or payment.status == 1: for attempt in payment.htlcs: - if attempt.status == 1: + if attempt.status == 1 or attempt.status == 0: hops = attempt.route.hops hop_count = 0 cost_to = 0 @@ -74,10 +75,10 @@ def update_payment(stub, payment, self_pubkey): db_payment.status = payment.status db_payment.index = payment.payment_index db_payment.save() - if payment.status == 2: + if payment.status == 2 or payment.status == 1: PaymentHops.objects.filter(payment_hash=db_payment).delete() for attempt in payment.htlcs: - if attempt.status == 1: + if attempt.status == 1 or attempt.status == 0: hops = attempt.route.hops hop_count = 0 cost_to = 0