CLN: return payment failure if no payment is found (#2113)

* CLN: return payment failure if no payment is found
This commit is contained in:
callebtc 2023-11-21 08:54:55 -03:00 committed by GitHub
parent e65ec56276
commit 0eb74c86ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,8 +169,12 @@ class CoreLightningWallet(Wallet):
r: dict = self.ln.listpays(payment_hash=checking_id) # type: ignore
except Exception:
return PaymentStatus(None)
if "pays" not in r or not r["pays"]:
if "pays" not in r:
return PaymentStatus(None)
if not r["pays"]:
# no payment with this payment_hash is found
return PaymentStatus(False)
payment_resp = r["pays"][-1]
if payment_resp["payment_hash"] == checking_id: