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

dev(regtest): prepare 'wait-for-bitcoind' feature #559

Merged
merged 3 commits into from
Nov 9, 2022

Conversation

theborakompanioni
Copy link
Collaborator

@theborakompanioni theborakompanioni commented Nov 3, 2022

This is the test branch for joinmarket-webui/jam-docker#76.

Once joinmarket-webui/jam-docker#76 is merged and a new jam-dev-standalone:master image has been created, the last commit of this PR will be reverted and this PR can be undrafted.

Please do not merge it without reverting the image base for the additional contains from jam-dev-standalone:wait-for-bitcoind back to jam-dev-standalone:master!

This PR removes the need for the READY_FILE in the secondary JM instance (jm_regtest_joinmarket2) and relies on the WAIT_FOR_BITCOIND env var to default to true. The tertiary instance (jm_regtest_joinmarket3) verifies that WAIT_FOR_BITCOIND can be disabled and the READY_FILE feature continues to work as expected. Please keep in mind that the primary test instance (jm_regtest_joinmarket) does not use the official "dev"-base image at all!

How to test

Build your env environment with npm run regtest:build (makes sure new images are pulled) and run npm run regtest:up.
The environment should start normally as usual. npm run regtest:init should be able to create wallets on all instances.

You should see the following in the logs:

For jm_regtest_joinmarket2 (enabling WAIT_FOR_BITCOIND and not using READY_FILE):

jm_regtest_joinmarket2          | Waiting for bitcoind to accept RPC requests...
jm_regtest_bitcoind             | 2022-11-02T10:36:08.423004Z ThreadRPCServer method=getblockchaininfo user=joinmarket2
jm_regtest_joinmarket2          | Successfully waited for bitcoind to accept RPC requests.

For jm_regtest_joinmarket3 (disabling WAIT_FOR_BITCOIND and using READY_FILE):

jm_regtest_joinmarket3          | Waiting for file /root/.regtest-initializer/btc_fully_synched to be created...
jm_regtest_joinmarket3          | Successfully waited for file /root/.regtest-initializer/btc_fully_synched to be created.

You should NOT see Waiting for bitcoind to accept RPC requests... for jm_regtest_joinmarket3.


Also, see what happens when jm_regtest_bitcoind_initializer mines 99 instead of 101 blocks.
Then you should see getblockchaininfo calls from jm_regtest_joinmarket2 every 5 seconds:


jm_regtest_bitcoind             | 2022-11-02T10:36:42.020179Z ThreadRPCServer method=getblockchaininfo user=joinmarket2
jm_regtest_bitcoind             | 2022-11-02T10:36:47.130406Z ThreadRPCServer method=getblockchaininfo user=joinmarket2
jm_regtest_bitcoind             | 2022-11-02T10:36:52.210399Z ThreadRPCServer method=getblockchaininfo user=joinmarket2
[...]

In case bitcoind is not available at all, jm_regtest_joinmarket2 should be "stuck" and wait for it to come up indefinitely:

jm_regtest_joinmarket2          | Waiting for bitcoind to accept RPC requests...
[...]

@theborakompanioni
Copy link
Collaborator Author

joinmarket-webui/jam-docker#76 is merged. Waiting for https://github.com/joinmarket-webui/jam-docker/actions/runs/3427611995 to finish before reverting the last commit and undrafting this PR. 🙌

@theborakompanioni theborakompanioni marked this pull request as ready for review November 9, 2022 13:14
Copy link
Contributor

@dergigi dergigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me ✅

@theborakompanioni theborakompanioni merged commit 6e2ee47 into master Nov 9, 2022
@theborakompanioni theborakompanioni deleted the docker-wait-for-bitcoind branch November 9, 2022 17:45
@dergigi dergigi added the bug Something isn't working label Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working devtools Improvements in tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants