From 53aa73b7c729ded836bb2cdbe68a688b5b0e0beb Mon Sep 17 00:00:00 2001 From: calle <93376500+callebtc@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:44:05 +0100 Subject: [PATCH] Fix/multimind_redeem_unused_keysets (#108) * multmind fix * bump version * fix verify_mints --- README.md | 2 +- cashu/core/settings.py | 2 +- cashu/wallet/cli_helpers.py | 8 ++++++-- pyproject.toml | 2 +- setup.py | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d68c87d..b86301d 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ cashu info Returns: ```bash -Version: 0.9.0 +Version: 0.9.1 Debug: False Cashu dir: /home/user/.cashu Wallet: wallet diff --git a/cashu/core/settings.py b/cashu/core/settings.py index a9ca5c6..2613ec8 100644 --- a/cashu/core/settings.py +++ b/cashu/core/settings.py @@ -66,4 +66,4 @@ NOSTR_RELAYS = env.list( ) MAX_ORDER = 64 -VERSION = "0.9.0" +VERSION = "0.9.1" diff --git a/cashu/wallet/cli_helpers.py b/cashu/wallet/cli_helpers.py index 1db6231..ef03fce 100644 --- a/cashu/wallet/cli_helpers.py +++ b/cashu/wallet/cli_helpers.py @@ -29,10 +29,12 @@ async def verify_mints(ctx: Context, token: TokenV2): if token.mints is None: return + proofs_keysets = set([p.id for p in token.proofs]) + logger.debug(f"Verifying mints") trust_token_mints = True for mint in token.mints: - for keyset in set(mint.ids): + for keyset in set([id for id in mint.ids if id in proofs_keysets]): # init a temporary wallet object keyset_wallet = Wallet( mint.url, os.path.join(CASHU_DIR, ctx.obj["WALLET_NAME"]) @@ -77,8 +79,10 @@ async def redeem_multimint(ctx: Context, token: TokenV2, script, signature): if token.mints is None: return + proofs_keysets = set([p.id for p in token.proofs]) + for mint in token.mints: - for keyset in set(mint.ids): + for keyset in set([id for id in mint.ids if id in proofs_keysets]): logger.debug(f"Redeeming tokens from keyset {keyset}") # init a temporary wallet object keyset_wallet = Wallet( diff --git a/pyproject.toml b/pyproject.toml index 131ce8b..e2d60e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cashu" -version = "0.9.0" +version = "0.9.1" description = "Ecash wallet and mint." authors = ["calle "] license = "MIT" diff --git a/setup.py b/setup.py index 42a0172..815f539 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ entry_points = {"console_scripts": ["cashu = cashu.wallet.cli:cli"]} setuptools.setup( name="cashu", - version="0.9.0", + version="0.9.1", description="Ecash wallet and mint for Bitcoin Lightning", long_description=long_description, long_description_content_type="text/markdown",