From 9d5efa6c2e0f77e48907afbc8397ebd8d49710c6 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Sun, 9 Jul 2023 00:43:00 +0200 Subject: [PATCH] clarify variable names (#279) --- cashu/wallet/wallet.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cashu/wallet/wallet.py b/cashu/wallet/wallet.py index 35a1caf..9eeaf09 100644 --- a/cashu/wallet/wallet.py +++ b/cashu/wallet/wallet.py @@ -635,15 +635,16 @@ class Wallet(LedgerAPI): if split: logger.trace(f"Mint with split: {split}") assert sum(split) == amount, "split must sum to amount" + allowed_amounts = [2**i for i in range(settings.max_order)] for a in split: - if a not in [2**i for i in range(settings.max_order)]: + if a not in allowed_amounts: raise Exception( f"Can only mint amounts with 2^n up to {2**settings.max_order}." ) # if no split was specified, we use the canonical split - split = split or amount_split(amount) - proofs = await super().mint(split, hash) + amounts = split or amount_split(amount) + proofs = await super().mint(amounts, hash) if proofs == []: raise Exception("received no proofs.") await self._store_proofs(proofs)