diff --git a/tests/test_vault.py b/tests/test_vault.py index a71e86c..80ff9c0 100644 --- a/tests/test_vault.py +++ b/tests/test_vault.py @@ -27,16 +27,16 @@ def test_vault_recover(manager: ContractManager, report_file: TextIOWrapper): out_instances = V_inst("recover", out_i = 0) - out: CTxOut = V_inst.spending_tx.vout[0] + out: CTxOut = V_inst.spending_tx.vout[0] assert out.nValue == amount assert out.scriptPubKey == OpaqueP2TR(recover_priv_key.pubkey[1:]).get_tr_info().scriptPubKey - report_file.write(format_tx_markdown(V_inst.spending_tx, "A recover transaction from the Vault")) + report_file.write(format_tx_markdown(V_inst.spending_tx, "Recovery from vault, 1 input [NoRecoveryAuth]")) assert len(out_instances) == 0 -def test_vault_trigger_and_recover(manager: ContractManager): +def test_vault_trigger_and_recover(manager: ContractManager, report_file: TextIOWrapper): locktime = 10 V = Vault(None, locktime, recover_priv_key.pubkey[1:], unvault_priv_key.pubkey[1:]) @@ -55,12 +55,17 @@ def test_vault_trigger_and_recover(manager: ContractManager): [U_inst] = V_inst("trigger", signer = signer, out_i = 0, ctv_hash = ctv_tmpl.get_standard_template_hash(0)) + report_file.write(format_tx_markdown(V_inst.spending_tx, "Trigger [3 vault inputs]")) + + out_instances = U_inst("recover", out_i = 0) assert len(out_instances) == 0 + report_file.write(format_tx_markdown(U_inst.spending_tx, "Recovery from trigger")) -def test_vault_trigger_and_withdraw(rpc: AuthServiceProxy, manager: ContractManager): + +def test_vault_trigger_and_withdraw(rpc: AuthServiceProxy, manager: ContractManager, report_file: TextIOWrapper): locktime = 10 V = Vault(None, locktime, recover_priv_key.pubkey[1:], unvault_priv_key.pubkey[1:]) @@ -79,6 +84,7 @@ def test_vault_trigger_and_withdraw(rpc: AuthServiceProxy, manager: ContractMana [U_inst] = V_inst("trigger", signer = signer, out_i = 0, ctv_hash = ctv_tmpl.get_standard_template_hash(0)) + report_file.write(format_tx_markdown(V_inst.spending_tx, "Trigger [3 vault inputs]")) spend_tx, _ = manager.get_spend_tx( (U_inst, "withdraw", {"ctv_hash": ctv_tmpl.get_standard_template_hash(0)}) @@ -105,10 +111,11 @@ def test_vault_trigger_and_withdraw(rpc: AuthServiceProxy, manager: ContractMana manager.spend_and_wait(U_inst, spend_tx) + report_file.write(format_tx_markdown(U_inst.spending_tx, "Withdraw [3 outputs]")) + -def test_vault_trigger_with_revault_and_withdraw(rpc: AuthServiceProxy, manager: ContractManager): - # normal-with-revault-3-inputs.txt +def test_vault_trigger_with_revault_and_withdraw(rpc: AuthServiceProxy, manager: ContractManager, report_file: TextIOWrapper): # get coins on 3 different Vaults, then trigger with partial withdrawal # one of the vault uses "trigger_with_revault", the others us normal "trigger" @@ -152,6 +159,8 @@ def test_vault_trigger_with_revault_and_withdraw(rpc: AuthServiceProxy, manager: [U_inst] = manager.spend_and_wait([V_inst_1, V_inst_2, V_inst_3], spend_tx) + report_file.write(format_tx_markdown(spend_tx, "Trigger (with revault) [3 vault inputs]")) + spend_tx, _ = manager.get_spend_tx( (U_inst, "withdraw", {"ctv_hash": ctv_tmpl.get_standard_template_hash(0)}) ) @@ -172,4 +181,6 @@ def test_vault_trigger_with_revault_and_withdraw(rpc: AuthServiceProxy, manager: mine_blocks(rpc, locktime - 1) - manager.spend_and_wait(U_inst, spend_tx) \ No newline at end of file + manager.spend_and_wait(U_inst, spend_tx) + + report_file.write(format_tx_markdown(U_inst.spending_tx, "Withdraw (3 outputs)")) \ No newline at end of file