From 13d6d5bd6065c76ae684f9a8ec559cdb39aeec1a Mon Sep 17 00:00:00 2001 From: Shroominic Date: Sat, 2 Aug 2025 00:05:37 -0300 Subject: [PATCH] fix cashuA parsing --- router/payment/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router/payment/helpers.py b/router/payment/helpers.py index 92690723..d04216d9 100644 --- a/router/payment/helpers.py +++ b/router/payment/helpers.py @@ -113,7 +113,7 @@ def check_token_balance(headers: dict, body: dict) -> Literal["sat", "msat"]: try: _token = base64_token_json(cashu_token) amount = sum(p["amount"] for t in _token["token"] for p in t["proofs"]) - unit: Literal["sat", "msat"] = _token["unit"] + unit: Literal["sat", "msat"] = _token.get("unit", "sat") if unit == "sat": amount *= 1000 @@ -122,7 +122,7 @@ def check_token_balance(headers: dict, body: dict) -> Literal["sat", "msat"]: "CashuA token parsed successfully", extra={ "amount": amount, - "unit": _token["unit"], + "unit": unit, "amount_msats": amount, "required_cost_msats": cost, "sufficient_balance": amount >= cost,