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

Add testing on Compact Block filters in CI #668

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/cont_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ jobs:
- name: esplora
testprefix: esplora
features: test-esplora,use-esplora-ureq,verify
- name: compact-filters
testprefix: blockchain::compact_filters::test
features: test-compact-filters
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test-electrum = ["electrum", "electrsd/electrs_0_8_10", "electrsd/bitcoind_22_0"
test-rpc = ["rpc", "electrsd/electrs_0_8_10", "electrsd/bitcoind_22_0", "test-blockchains"]
test-rpc-legacy = ["rpc", "electrsd/electrs_0_8_10", "electrsd/bitcoind_0_20_0", "test-blockchains"]
test-esplora = ["electrsd/legacy", "electrsd/esplora_a33e97e1", "electrsd/bitcoind_22_0", "test-blockchains"]
test-compact-filters = ["compact_filters", "electrsd/electrs_0_8_10", "electrsd/bitcoind_22_0", "test-blockchains"]
test-md-docs = ["electrum"]

[dev-dependencies]
Expand Down
19 changes: 19 additions & 0 deletions src/blockchain/compact_filters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,3 +580,22 @@ impl From<crate::error::Error> for CompactFiltersError {
CompactFiltersError::Global(Box::new(err))
}
}

#[cfg(test)]
#[cfg(feature = "test-compact-filters")]
mod test {

use super::*;

crate::bdk_blockchain_tests! {
fn test_instance(test_client: &TestClient) -> CompactFiltersBlockchain {
let bitcoind_port = test_client.bitcoind.params.rpc_socket.port();
let num_threads = 2;
let mempool = Arc::new(Mempool::default());
let peers = (0..num_threads)
.map(|_| Peer::connect(format!("localhost:{}", bitcoind_port), Arc::clone(&mempool), Network::Regtest))
.collect::<Result<_, _>>().unwrap();
CompactFiltersBlockchain::new(peers, "./wallet-filters", Some(0)).unwrap()
Comment on lines +592 to +598
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested yet, but I don't think this logic will work..

  • You can't get compact filters from rpc port. You have to connect to the p2p port.
  • The test client doesn't serve compact filters by default. You need to set a extra bitcoind args parameter accordingly to turn that on the test client.. Which can be done under a feature gate..

}
}
}