fix cashuA parsing

This commit is contained in:
Shroominic
2025-08-02 00:05:37 -03:00
parent b313017492
commit 13d6d5bd60
+2 -2
View File
@@ -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,