diff --git a/cashu/core/settings.py b/cashu/core/settings.py index 41afa2c..41003ce 100644 --- a/cashu/core/settings.py +++ b/cashu/core/settings.py @@ -12,6 +12,7 @@ if not os.path.isfile(ENV_FILE): if os.path.isfile(ENV_FILE): env.read_env(ENV_FILE) else: + ENV_FILE = None env.read_env() DEBUG = env.bool("DEBUG", default=False) diff --git a/cashu/wallet/cli.py b/cashu/wallet/cli.py index ab583f2..ebc0edf 100755 --- a/cashu/wallet/cli.py +++ b/cashu/wallet/cli.py @@ -241,8 +241,6 @@ async def lock(ctx): wallet: Wallet = ctx.obj["WALLET"] p2shscript = await wallet.create_p2sh_lock() txin_p2sh_address = p2shscript.address - txin_redeemScript_b64 = p2shscript.script - txin_signature_b64 = p2shscript.signature print("---- Pay to script hash (P2SH) ----\n") print("Use a lock to receive coins that only you can unlock.") print("") diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 8e61a80..5800910 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -130,6 +130,15 @@ async def run_test(): wallet1.proofs, 65, snd_secret=secret ) + # p2sh test + p2shscript = await wallet2.create_p2sh_lock() + txin_p2sh_address = p2shscript.address + lock = f"P2SH:{txin_p2sh_address}" + _, send_proofs = await wallet1.split_to_send(wallet1.proofs, 8, lock) + _, _ = await wallet2.redeem( + send_proofs, snd_script=p2shscript.script, snd_siganture=p2shscript.signature + ) + # strip away the secrets w1_snd_proofs_manipulated = w1_snd_proofs.copy() for p in w1_snd_proofs_manipulated: @@ -139,22 +148,6 @@ async def run_test(): "Mint Error: no secret in proof.", ) - # redeem with wrong secret - await assert_err( - wallet2.redeem(w1_snd_proofs_manipulated, f"{secret}_asd"), - "Mint Error: could not verify proofs.", - ) - - # redeem with correct secret - await wallet2.redeem(w1_snd_proofs_manipulated, secret) - - # try to redeem them again - # NOTE: token indexing suffix _0 - await assert_err( - wallet2.redeem(w1_snd_proofs_manipulated, secret), - f"Mint Error: tokens already spent. Secret: 0:{secret}", - ) - if __name__ == "__main__": async_unwrap(run_test())