Skip to content

Commit

Permalink
Add test to check sigs fetching for secured vaults
Browse files Browse the repository at this point in the history
Test that when a vault is secured and a user starts
signing the unvault tx, every other participants
retrieve and store the signature.
  • Loading branch information
edouardparis committed Feb 24, 2022
1 parent b08ee27 commit 6b5af94
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 6b5af94

Please sign in to comment.