So I have multiple instances of bitcoind in regtest mode. 1 instance is for the app wallet and one stimulates a wallet of a possible user.

I want to perform various functional and integration tests of the app.

Basic example, if user sends bitcoin from his wallet is that bitcoin correctly received by the app.

The problem though is that there is a time delay before that receiving node notices the transaction (even when both instances are on same machine). This screws up my tests, I tried putting in a sleep(10) function in my test code and that increases the success, but sometimes they still fail and I cant have my automated tests taking so long. (plus its seems very inelegant).

I'm wondering how others deal with this.

1 Answer 1


I would separate out the unit tests and the integration tests.

If the function needs to go out to the internet or wait for the blockchain, I make them integration tests which I can run less frequently like every five minutes. The functions that are fast I like to run every 10 seconds.

Linking the errors to sensible time stamped logs like pm2 and key-metrics allows you to see what has been going on while you were sleeping.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.