From 4c0bd132b140422c976a7275665e5e07ba330449 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 12 Mar 2024 13:56:36 +0100 Subject: [PATCH] bug: cln paymentstate check on error (#2151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CLN: paymentstate check on error --------- Co-authored-by: dni ⚡ --- lnbits/wallets/corelightning.py | 7 +------ lnbits/wallets/corelightningrest.py | 3 --- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lnbits/wallets/corelightning.py b/lnbits/wallets/corelightning.py index d9cdff810..7cdf27b33 100644 --- a/lnbits/wallets/corelightning.py +++ b/lnbits/wallets/corelightning.py @@ -139,8 +139,6 @@ class CoreLightningWallet(Wallet): f" '{exc.error.get('message') or exc.error}'." # type: ignore ) return PaymentResponse(False, None, None, None, error_message) - except Exception as exc: - return PaymentResponse(False, None, None, None, str(exc)) fee_msat = -int(r["amount_sent_msat"] - r["amount_msat"]) return PaymentResponse( @@ -173,11 +171,8 @@ class CoreLightningWallet(Wallet): r: dict = self.ln.listpays(payment_hash=checking_id) # type: ignore except Exception: return PaymentStatus(None) - if "pays" not in r: + if "pays" not in r or not r["pays"]: return PaymentStatus(None) - if not r["pays"]: - # no payment with this payment_hash is found - return PaymentStatus(False) payment_resp = r["pays"][-1] diff --git a/lnbits/wallets/corelightningrest.py b/lnbits/wallets/corelightningrest.py index 643d34fdd..94414230c 100644 --- a/lnbits/wallets/corelightningrest.py +++ b/lnbits/wallets/corelightningrest.py @@ -162,9 +162,6 @@ class CoreLightningRestWallet(Wallet): data = r.json() - if data["status"] != "complete": - return PaymentResponse(False, None, None, None, "payment failed") - checking_id = data["payment_hash"] preimage = data["payment_preimage"] fee_msat = data["msatoshi_sent"] - data["msatoshi"]