diff --git a/cashu/wallet/cli/cli.py b/cashu/wallet/cli/cli.py index 80c5d6c..605ef24 100644 --- a/cashu/wallet/cli/cli.py +++ b/cashu/wallet/cli/cli.py @@ -576,7 +576,9 @@ async def burn(ctx: Context, token: str, all: bool, force: bool, delete: str): if delete: await wallet.invalidate(proofs) else: - await wallet.invalidate(proofs, check_spendable=True) + # batch check proofs + for _proofs in [proofs[i : i + 100] for i in range(0, len(proofs), 100)]: + await wallet.invalidate(_proofs, check_spendable=True) print_balance(ctx) diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index 46d78ec..aef3dc1 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -157,7 +157,12 @@ class LedgerAPI(LedgerAPIDeprecated, object): Raises: Exception: if the response contains an error """ - resp_dict = resp.json() + try: + resp_dict = resp.json() + except json.JSONDecodeError: + # if we can't decode the response, raise for status + resp.raise_for_status() + return if "detail" in resp_dict: logger.trace(f"Error from mint: {resp_dict}") error_message = f"Mint Error: {resp_dict['detail']}"