bitcoindevkit / bdk-cli

A CLI wallet library and REPL tool to demo and test the BDK library
Other
108 stars 64 forks source link

Compact filter #26

Closed rajarshimaitra closed 3 years ago

rajarshimaitra commented 3 years ago

Description

This PR adds the compact filter configuration to connect bdk-cli with a Bitcoin Core node serving compact filters.

Note to Reviewers

I have updated the Readme doc with new usage instruction. If thats not clear (because github doesn't show .md outputs in PR) below is the instruction:

To sync a wallet to Bitcoin Core node (assuming a regtest node at 127.0.0.1:18444) serving compact filters:

Then run:

cargo run --features compact_filters -- --network regtest wallet --node 127.0.0.1:18444 --descriptor "wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)" sync

Checklists

All Submissions:

New Features:

Bugfixes:

rajarshimaitra commented 3 years ago

Updated with the requested changes.

rajarshimaitra commented 3 years ago

Updated the database_path to include wallet-name provided with cli args, or use the default name.

The objective is to keep multiple wallet data directories separate.

This PR is ready for a second look.

rajarshimaitra commented 3 years ago

Updated with requested changes. Code is ready for further testing and review.

rajarshimaitra commented 3 years ago

Update for Reviewers

There is a likely error like this while trying to connect to a full node.

$ ./target/debug/bdk-cli --network regtest wallet --node 127.0.0.1:18444 --descriptor $desc sync
[2021-05-26T14:18:18Z ERROR bdk_cli] CompactFilters(InvalidHeaders)

This happens while connecting to fresh instant of regtest-box while having the old ~/.bdk-bitcoin/compact_filters datadir. The previous filters are not valid for the new regtest node.

Solution is to to delete the datadir, then run.

notmandatory commented 3 years ago

Looks like the electrum test is failing, I can show you how to spin up docker to run the tests. The steps are also on the bitcoin-regtest-box README under Local bdk testing.

rajarshimaitra commented 3 years ago

@notmandatory Yes, the doc tests were failing as I forgot to change them to be compatible with the current WalletOpts structure. The tests should pass now.

Note:

Looks like the electrum test is failing, I can show you how to spin up docker to run the tests.

It doesn't need docker containers to run the bdk-cli tests. That also means we are not covering any functional tests with bdk-cli. I think that's ok because BDK functionalities are already tested upstream.