We recently had a call to discuss how we can improve the blockchain tests. Bits:
Blockchain test problems
Minimint does all its testing manually (spawning nodes with bash scripts, etc), it would be cool to use the BDK macros instead
We realized it's not really possible, as minimint is not using the BDK Blockchain trait
We're not testing with all the Bitcoin Core versions, only the recent ones
We have a TestUtils struct which is used for every blockchain test, and uses both electrsd and core. electrsd is not needed for testing the rpc, but we keep it there as it's needed for electrum/esplora, and the structure is the same for every test. electrsd is not compatible with older versions of core.
Split the BlockchainTrait in two parts - one for fetching the data and one for processing it
Tests fetching the data using the real backend
Tests processing the data using mocked data from our blockchain
Always have bitcoind running, then if we have to test i.e. electrum, we run electrsd
You might have some race condition where bitcoind has seen the transaction, but electrsd still hasn't -> bitcoind tells you you have balance, but electrsd doesn't
For this reason, you need some closures for waiting txs and blocks -> This has to be a trait, either on the TestClient level, or on a lower level
Easier to implement than 1, and we don't modify the public blockchain API, so we decided to go for this one
Opening this issue for tracking the development of the second idea
We recently had a call to discuss how we can improve the blockchain tests. Bits:
Blockchain test problems
Minimint does all its testing manually (spawning nodes with bash scripts, etc), it would be cool to use the BDK macros instead
We're not testing with all the Bitcoin Core versions, only the recent ones
Ideas
Mock the blockchain backend (https://github.com/bitcoindevkit/bdk/issues/543)
Always have bitcoind running, then if we have to test i.e. electrum, we run electrsd
Opening this issue for tracking the development of the second idea