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

Faster Blockchain Implementation for testing? #690

Open
casey opened this issue Jul 29, 2022 · 5 comments
Open

Faster Blockchain Implementation for testing? #690

casey opened this issue Jul 29, 2022 · 5 comments
Labels
new feature New feature or request tests

Comments

@casey
Copy link

casey commented Jul 29, 2022

I'm working on a wallet with a bunch of integration tests. Currently we use RpcBlockchain for testing, but it's very slow. It would be nice if there was a fast Blockchain implementation for testing.

@danielabrozzoni
Copy link
Member

This is also related to #543, I think :)

@danielabrozzoni danielabrozzoni added new feature New feature or request tests labels Jul 30, 2022
@casey
Copy link
Author

casey commented Jul 30, 2022

I actually think this is basically a dupe of #543. It would take some extremely poor implementation decisions for a test blockchain backend to be slow 😄

@casey
Copy link
Author

casey commented Aug 1, 2022

Which is more complex, implementing bdk::blockchain::Blockchain, or implementing a simple in-memory Bitcoin RPC server that can service requests for RpcBlockchain? If the latter is simpler, then that might be the easiest route to take: Implement an in-memory RPC server with all calls that RpcBlockchain uses, and then use that for testing. This would also be useful outside of bdk, for any project that needs to test against a Bitcoin Core node.

@casey
Copy link
Author

casey commented Aug 1, 2022

Looking at the calls that RpcBlockchain makes, I'm not sure if implementing a dummy RpcClient would be easy:

getaddressinfo
getblockchaininfo
getindexinfo
getnetworkinfo
getwalletinfo
listtransactions
listunspent
listwalletdir
listwallets
sendrawtransaction
setlabel

@rajarshimaitra
Copy link
Contributor

The main problem with dummy RPC blockchain is not the interface imo (which although is a big task) but simulating the the core's validation logic. The main use of the blockchain for testing is to check weather transaction stuffs are created as per consensus correctly, more than sending and getting data out.. That might take some significant amount of effort to mock..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request tests
Projects
Status: No status
Development

No branches or pull requests

3 participants