bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Test blockchain backend

Open LLFourn opened this issue 3 years ago • 6 comments

Rather than running a regtest node it would be cool if we just had a simulated blockchain that we could do things to from test code.

idea originally from: https://github.com/bitcoindevkit/bdk/issues/446

LLFourn avatar Feb 16 '22 02:02 LLFourn

Ideally it would also be fast. We're running tests against regtest nodes, and our main issue is that it's very slow.

casey avatar Jul 30 '22 07:07 casey

Happy to mentor someone on this issue if anyone wants to have a shot. It looks like fun!

LLFourn avatar Aug 01 '22 02:08 LLFourn

See my comment here: https://github.com/bitcoindevkit/bdk/issues/690#issuecomment-1201471031

TL;DR Maybe we should implement a dummy RPC server instead of a dummy bdk::blockchain::Blockchain?

casey avatar Aug 01 '22 17:08 casey

Where we would use this backend, btw? In src/testutils/blockchain_tests.rs, I suppose?

TL;DR Maybe we should implement a dummy RPC server instead of a dummy bdk::blockchain::Blockchain?

Eh, to me it looks more though to implement a dummy RPC server, but I don't really know...

danielabrozzoni avatar Aug 06 '22 11:08 danielabrozzoni

One thing I was wondering was, for this to work, we need to mock a considerable portion of bitcoin core's mempool and other behaviors too, if we wanna use it for any meaningful testing situation.. Not sure how difficult or worthwhile its gonna be..

rajarshimaitra avatar Aug 23 '22 15:08 rajarshimaitra

@vladimirfomene as we discussed on discord, with the new 1.0 bdk electrum/esplora/rpc clients it's worth taking another look at using a mocking framework instead of or in addition to our current integration tests. One framework that looks like it could do the job is https://docs.rs/mockall/latest/mockall/.

notmandatory avatar Sep 21 '23 14:09 notmandatory

Moved to beta release since this is a testing issue. Due to level of work to do this may have to push it out to a post 1.0 release.

notmandatory avatar Mar 18 '24 00:03 notmandatory