Skip to content

Commit 6ac12a1

Browse files
committed
Merge #181: feat(cbf): add cbf feature using bdk_kyoto
6debc68 feat(cbf): add cbf feature using bdk_kyoto (Vihiga Tyonum) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description This PR re-enables the Compact Block Filters (cbf) feature using `bdk_kyoto` and it is part of updating the library to use the latest `bdk` crates. <!-- Describe the purpose of this PR, what's being adding and/or fixed --> ### Notes to the reviewers This is part of issue #172 <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ### Checklists * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk-cli/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: rustaceanrob: ACK 6debc68 notmandatory: ACK 6debc68 Tree-SHA512: d78d9d2840b377bcb8876421b6133fdaecd3d5c2bdf60438769b09e71282b662bdf5c8e7aa53edb121efff5d1b17637c498a363cc279a3ba8ad6121dae849864
2 parents 2fa18a0 + 6debc68 commit 6ac12a1

File tree

7 files changed

+258
-73
lines changed

7 files changed

+258
-73
lines changed

.github/workflows/code_coverage.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ jobs:
3535
- name: Test Esplora
3636
run: cargo test --features esplora
3737

38-
# Temporarily disable compact filters
39-
#- name: Test Compact Filters
40-
# run: cargo test --features compact_filters
41-
38+
- name: Test Cbf
39+
run: cargo test --features cbf
40+
4241
- name: Test RPC
4342
run: cargo test --features rpc
4443

Cargo.lock

Lines changed: 89 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ tokio = { version = "1", features = ["full"] }
2525
bdk_bitcoind_rpc = { version = "0.18.0", optional = true }
2626
bdk_electrum = { version = "0.21.0", optional = true }
2727
bdk_esplora = { version = "0.20.1", features = ["async-https", "tokio"], optional = true }
28-
bdk_kyoto = { version = "0.7.1", optional = true }
28+
bdk_kyoto = { version = "0.9.0", optional = true }
2929
shlex = { version = "1.3.0", optional = true }
30+
tracing = "0.1.41"
31+
tracing-subscriber = "0.3.19"
3032

3133
[features]
3234
default = ["repl", "sqlite"]

src/commands.rs

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ use bdk_wallet::bitcoin::{
2020
};
2121
use clap::{value_parser, Args, Parser, Subcommand, ValueEnum};
2222

23-
#[cfg(any(
24-
feature = "cbf",
25-
feature = "electrum",
26-
feature = "esplora",
27-
feature = "rpc"
28-
))]
23+
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
2924
use crate::utils::parse_proxy_auth;
3025
use crate::utils::{parse_address, parse_outpoint, parse_recipient};
3126

@@ -133,7 +128,12 @@ pub enum DatabaseType {
133128
Sqlite,
134129
}
135130

136-
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
131+
#[cfg(any(
132+
feature = "electrum",
133+
feature = "esplora",
134+
feature = "rpc",
135+
feature = "cbf"
136+
))]
137137
#[derive(Clone, ValueEnum, Debug, Eq, PartialEq)]
138138
pub enum ClientType {
139139
#[cfg(feature = "electrum")]
@@ -142,6 +142,8 @@ pub enum ClientType {
142142
Esplora,
143143
#[cfg(feature = "rpc")]
144144
Rpc,
145+
#[cfg(feature = "cbf")]
146+
Cbf,
145147
}
146148

147149
/// Config options wallet operations can take.
@@ -159,7 +161,12 @@ pub struct WalletOpts {
159161
/// Sets the descriptor to use for internal/change addresses.
160162
#[arg(env = "INT_DESCRIPTOR", short = 'i', long)]
161163
pub int_descriptor: Option<String>,
162-
#[cfg(any(feature = "electrum", feature = "esplora", feature = "rpc"))]
164+
#[cfg(any(
165+
feature = "electrum",
166+
feature = "esplora",
167+
feature = "rpc",
168+
feature = "cbf"
169+
))]
163170
#[arg(env = "CLIENT_TYPE", short = 'c', long, value_enum, required = true)]
164171
pub client_type: ClientType,
165172
#[cfg(feature = "sqlite")]
@@ -196,10 +203,13 @@ pub struct WalletOpts {
196203
/// Sets an optional cookie authentication.
197204
#[arg(env = "COOKIE")]
198205
pub cookie: Option<String>,
206+
#[cfg(feature = "cbf")]
207+
#[clap(flatten)]
208+
pub compactfilter_opts: CompactFilterOpts,
199209
}
200210

201211
/// Options to configure a SOCKS5 proxy for a blockchain client connection.
202-
#[cfg(any(feature = "cbf", feature = "electrum", feature = "esplora"))]
212+
#[cfg(any(feature = "electrum", feature = "esplora"))]
203213
#[derive(Debug, Args, Clone, PartialEq, Eq)]
204214
pub struct ProxyOpts {
205215
/// Sets the SOCKS5 proxy for a blockchain client.
@@ -228,26 +238,13 @@ pub struct ProxyOpts {
228238
#[cfg(feature = "cbf")]
229239
#[derive(Debug, Args, Clone, PartialEq, Eq)]
230240
pub struct CompactFilterOpts {
231-
/// Sets the full node network address.
232-
#[clap(
233-
env = "ADDRESS:PORT",
234-
long = "cbf-node",
235-
default_value = "127.0.0.1:18444"
236-
)]
237-
pub address: Vec<String>,
238-
239241
/// Sets the number of parallel node connections.
240-
#[clap(name = "CONNECTIONS", long = "cbf-conn-count", default_value = "4")]
241-
pub conn_count: usize,
242+
#[clap(name = "CONNECTIONS", long = "cbf-conn-count", default_value = "4", value_parser = value_parser!(u8).range(1..=15))]
243+
pub conn_count: u8,
242244

243245
/// Optionally skip initial `skip_blocks` blocks.
244-
#[clap(
245-
env = "SKIP_BLOCKS",
246-
short = 'k',
247-
long = "cbf-skip-blocks",
248-
default_value = "0"
249-
)]
250-
pub skip_blocks: usize,
246+
#[clap(env = "SKIP_BLOCKS", short = 'k', long = "cbf-skip-blocks")]
247+
pub skip_blocks: Option<u32>,
251248
}
252249

253250
/// Wallet subcommands that can be issued without a blockchain backend.

src/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,8 @@ pub enum BDKCliError {
8585
#[cfg(feature = "rpc")]
8686
#[error("RPC error: {0}")]
8787
BitcoinCoreRpcError(#[from] bdk_bitcoind_rpc::bitcoincore_rpc::Error),
88+
89+
#[cfg(feature = "cbf")]
90+
#[error("BDK-Kyoto error: {0}")]
91+
BuilderError(#[from] bdk_kyoto::builder::BuilderError),
8892
}

0 commit comments

Comments
 (0)