bug: cln paymentstate check on error (#2151)
* CLN: paymentstate check on error
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
This commit is contained in:
parent
7ce4eddb0e
commit
4c0bd132b1
2 changed files with 1 additions and 9 deletions
|
|
@ -139,8 +139,6 @@ class CoreLightningWallet(Wallet):
|
||||||
f" '{exc.error.get('message') or exc.error}'." # type: ignore
|
f" '{exc.error.get('message') or exc.error}'." # type: ignore
|
||||||
)
|
)
|
||||||
return PaymentResponse(False, None, None, None, error_message)
|
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"])
|
fee_msat = -int(r["amount_sent_msat"] - r["amount_msat"])
|
||||||
return PaymentResponse(
|
return PaymentResponse(
|
||||||
|
|
@ -173,11 +171,8 @@ 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:
|
if "pays" not in r or not r["pays"]:
|
||||||
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]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,9 +162,6 @@ class CoreLightningRestWallet(Wallet):
|
||||||
|
|
||||||
data = r.json()
|
data = r.json()
|
||||||
|
|
||||||
if data["status"] != "complete":
|
|
||||||
return PaymentResponse(False, None, None, None, "payment failed")
|
|
||||||
|
|
||||||
checking_id = data["payment_hash"]
|
checking_id = data["payment_hash"]
|
||||||
preimage = data["payment_preimage"]
|
preimage = data["payment_preimage"]
|
||||||
fee_msat = data["msatoshi_sent"] - data["msatoshi"]
|
fee_msat = data["msatoshi_sent"] - data["msatoshi"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue