From 6b5af941029a878d18db560fe6dbcea0061dc26f Mon Sep 17 00:00:00 2001 From: edouard Date: Wed, 23 Feb 2022 15:36:28 +0100 Subject: [PATCH] Add test to check sigs fetching for secured vaults Test that when a vault is secured and a user starts signing the unvault tx, every other participants retrieve and store the signature. --- tests/test_misc.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/test_misc.py b/tests/test_misc.py index 1d8094b7..239aab89 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -249,6 +249,45 @@ def test_sigfetcher_coordinator_dead(revault_network, bitcoind): stk.wait_for_secured_vaults([deposit]) +@pytest.mark.skipif(not POSTGRES_IS_SETUP, reason="Needs Postgres for servers db") +def test_sigfetcher_secured_vaults(revault_network, bitcoind): + """ + Test that unvault sigs are retrieved and stored for secured vault even if the + daemon user did not start activating it or is not a stakeholder. + """ + rn = revault_network + rn.deploy( + 3, + 1, + csv=1, + with_cosigs=False, + with_watchtowers=False, + ) + vault = rn.fund(1) + rn.secure_vault(vault) + stks = rn.stks() + + outpoint = f"{vault['txid']}:{vault['vout']}" + unvault_psbt = stks[0].rpc.getunvaulttx(outpoint)["unvault_tx"] + unvault_psbt = stks[0].stk_keychain.sign_unvault_psbt( + unvault_psbt, vault["derivation_index"] + ) + stks[0].rpc.unvaulttx(outpoint, unvault_psbt) + + for stk in rn.participants(): + stk.wait_for_logs( + [ + "Syncing Unvault signature", + ] + ) + wait_for( + lambda: stk.rpc.listpresignedtransactions([outpoint])[ + "presigned_transactions" + ][0]["unvault"]["psbt"] + == unvault_psbt + ) + + @pytest.mark.skipif(not POSTGRES_IS_SETUP, reason="Needs Postgres for servers db") def test_stkman_only(revault_network, bitcoind): """Test a setup with only stakehodlers-managers"""