tests: introduce a lianad_multipath fixture as well as a trivial test

This commit is contained in:
Antoine Poinsot 2023-03-28 15:57:35 +02:00
parent 0d75f0a2c7
commit b20cdd0cd8
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
2 changed files with 40 additions and 0 deletions

View File

@ -189,3 +189,37 @@ def lianad_multisig(bitcoind, directory):
raise
lianad.cleanup()
@pytest.fixture
def lianad_multipath(bitcoind, directory):
datadir = os.path.join(directory, "lianad")
os.makedirs(datadir, exist_ok=True)
bitcoind_cookie = os.path.join(bitcoind.bitcoin_dir, "regtest", ".cookie")
# A 3-of-4 that degrades into a 3-of-5 after 10 blocks and into a 1-of-10 after 20 blocks.
csv_values = [10, 20]
signer = MultiSigner(4, {csv_values[0]: 5, csv_values[1]: 10})
prim_multi = multi_expression(3, signer.prim_hds)
first_recov_multi = multi_expression(3, signer.recov_hds[csv_values[0]])
second_recov_multi = multi_expression(1, signer.recov_hds[csv_values[1]])
main_desc = Descriptor.from_str(
f"wsh(or_d({prim_multi},or_i(and_v(v:{first_recov_multi},older({csv_values[0]})),and_v(v:{second_recov_multi},older({csv_values[1]})))))"
)
lianad = Lianad(
datadir,
signer,
main_desc,
bitcoind.rpcport,
bitcoind_cookie,
)
try:
lianad.start()
yield lianad
except Exception:
lianad.cleanup()
raise
lianad.cleanup()

View File

@ -75,6 +75,12 @@ def test_multisig(lianad_multisig, bitcoind):
lianad_multisig.rpc.broadcastspend(txid)
def test_multipath(lianad_multipath, bitcoind):
"""Exercise various commands as well as recovery with a descriptor with multiple
recovery paths."""
receive_and_send(lianad_multipath, bitcoind)
def test_coinbase_deposit(lianad, bitcoind):
"""Check we detect deposits from (mature) coinbase transactions."""
# Create a new deposit in a coinbase transaction.