bitcoindevkit / bdk

A modern, lightweight, descriptor-based wallet library written in Rust!
Other
850 stars 307 forks source link

Yet another issue on the blockchain tests #732

Open danielabrozzoni opened 2 years ago

danielabrozzoni commented 2 years ago

We recently had a call to discuss how we can improve the blockchain tests. Bits:

Blockchain test problems

Ideas

  1. Mock the blockchain backend (https://github.com/bitcoindevkit/bdk/issues/543)

    • 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
  2. 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

cryptoquick commented 2 years ago

As a fan of Animorphs, what is a "YA issue" ?

danielabrozzoni commented 2 years ago

Yet another :)