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

View File

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