fix: cln nodemanager errors on failed transactions (#2865)

This commit is contained in:
dni ⚡ 2025-01-13 16:58:37 +01:00 committed by GitHub
parent 982732cbd4
commit 2ee7180aa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -304,14 +304,19 @@ class CoreLightningNode(Node):
return [ return [
NodePayment( NodePayment(
bolt11=pay.get("bolt11"), bolt11=pay.get("bolt11"),
amount=pay["amount_msat"], amount=pay.get("amount_msat", 0),
fee=int(pay["amount_msat"]) - int(pay["amount_sent_msat"]), fee=int(pay.get("amount_msat", 0))
- int(pay.get("amount_sent_msat", 0)),
memo=pay.get("description"), memo=pay.get("description"),
time=pay["created_at"], time=pay["created_at"],
preimage=pay.get("preimage"), preimage=pay.get("preimage"),
payment_hash=pay["payment_hash"], payment_hash=pay["payment_hash"],
pending=pay["status"] != "complete", pending=pay["status"] != "complete",
destination=await self.get_peer_info(pay["destination"]), destination=(
await self.get_peer_info(pay.get("destination"))
if pay.get("destination")
else None
),
) )
for pay in reversed(result["pays"]) for pay in reversed(result["pays"])
if pay["status"] != "failed" if pay["status"] != "failed"