From 259e72167b710b44ac24624a26d74286e8773362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 5 Jun 2023 13:06:49 +0300 Subject: [PATCH] Hide unsuccessful outgoing lndhub txs in list --- app/controllers/services/lightning_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/services/lightning_controller.rb b/app/controllers/services/lightning_controller.rb index 4dd9607..573d155 100644 --- a/app/controllers/services/lightning_controller.rb +++ b/app/controllers/services/lightning_controller.rb @@ -86,6 +86,10 @@ class Services::LightningController < ApplicationController end end + # Handle an edge case where lndhub.go includes a failed payment in the + # list, which wasn't actually booked + txs.reject!{ |tx| tx["type"] == "paid_invoice" && tx["payment_preimage"].blank? } + txs.sort{ |a,b| b["datetime"] <=> a["datetime"] } end end