wizardsardine / liana

The missing safety net for your coins
https://wizardsardine.com/liana
BSD 3-Clause "New" or "Revised" License
321 stars 57 forks source link

Functional test for importing a descriptor, rescanning, then sweeping #202

Closed darosior closed 1 year ago

darosior commented 1 year ago

https://github.com/revault/liana/pull/182 only introudces a very basic functional test for the recovery transaction creation. It would be nice to also test the typical flow of a user that recovers coins.

Eunovo commented 1 year ago

@darosior I'm interested in working on this, can you assign it to me?

darosior commented 1 year ago

For sure! Reach out for guidance or validating the approach if you feel the need.

Eunovo commented 1 year ago

@darosior What's the typical flow for a user trying to recover coins? It looks like a user would have to take the following steps:

Is this flow correct?

If it is, how do I go about importing a new descriptor for testing? Do I create a new lianad instance for this test? Or try to call load_config with the existing lianad instance?

This test looks like something that will fit into test_misc.py

darosior commented 1 year ago

Sorry for the delay in responding, i was traveling.

Your flow is correct. To simulate the startup of a new lianad, i think you could use the restart_fresh method: https://github.com/wizardsardine/liana/blob/0406085ed5a23bfcfb94eb36ac79a2734ae38a3d/tests/test_framework/lianad.py#L105-L115

I think a better place than test_misc.py is test_chain.py. You could draw some inspiration from the test_rescan_edge_cases test. https://github.com/wizardsardine/liana/blob/0406085ed5a23bfcfb94eb36ac79a2734ae38a3d/tests/test_chain.py#L172