Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Framework + Claim/Refund Integration tests #24

Merged
merged 6 commits into from
Feb 28, 2024

Conversation

rajarshimaitra
Copy link
Contributor

This PR adds a basic test framework using the bitcoind crate. This is useful to test spending logic in regtest and verify that the most crucial part of the library is working. These tests are enforced in CI too.

This PR adds two integration tests using dummy swap values.

  • Claim: Spend the swap contract via a claim transaction using the preimage.
  • Refund: Spend the swap contract via a refund transaction using the timelock.

Some modification of the spend transaction assembly logic was required. And few other auxiliary changes.

@i5hi
Copy link
Collaborator

i5hi commented Feb 28, 2024

YES! Regtest framework!! :))))

@rajarshimaitra
Copy link
Contributor Author

Test failing becuase apparently cfg!(test) macro doesn't have any effect on the integration test. We need to set Network::Regtest for int test to handle address generation correctly.

There are two possible workaround:

  • Add a Chain::Regtest enum variant and set that in integration test.
  • Add a special int-test feature and run all the int tests only while under that feature, and the cfg!(feature = "int-test") to set the network to regtest for in tests.

I am inclining for the first option as it seems more cleaner.

@i5hi i5hi merged commit c74313e into SatoshiPortal:trunk Feb 28, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants