filter_iter example fails to compile on Windows because it depends on bdk_testenv
Context
Discovered while using BDK as a new developer: after the bdk_bitcoind_rpc library crate compiled, I followed the in-tree example instructions to run the only official example.
Reproduction
On Windows, from a checkout of this repository:
cargo build -p bdk_bitcoind_rpc
cargo build -p bdk_bitcoind_rpc --example filter_iter
The first command succeeds. The second fails.
crates/bitcoind_rpc/examples/README.md documents the same example as:
cargo run -p bdk_bitcoind_rpc --example filter_iter
Expected behavior
The documented example should compile on a host where bdk_bitcoind_rpc itself compiles. Runtime still needs a local bitcoind (RPC_URL / RPC_COOKIE); that is already documented. Compile should not require the Unix-only test harness.
Actual behavior
Building the example pulls in the bdk_testenv dev-dependency and fails in electrsd 0.38.1's build.rs:
error[E0433]: cannot find `unix` in `os`
--> electrsd-0.38.1\build.rs:14:18
|
14 | use std::os::unix::fs::PermissionsExt;
error[E0599]: no associated function or constant named `from_mode` found for struct `Permissions`
--> electrsd-0.38.1\build.rs:78:39
The example does not use TestEnv. It only imports anyhow from bdk_testenv:
use anyhow::Context;
use bdk_testenv::anyhow;
Because Cargo examples may use the package's dev-dependencies, that import is enough to compile electrsd.
Environment
- BDK commit:
0790f0400b108974b538e44d6498dc6fe1157548 - Crate:
bdk_bitcoind_rpc0.22.0 (filter_iterexample) - OS: Windows 10 (10.0.26200),
x86_64-pc-windows-msvc - Rust: rustc 1.97.1 (8bab26f4f 2026-07-14)
Which backend(s) are relevant (if any)?
- [x] Bitcoin Core RPC
Is this blocking production use?
- [ ] No
Additional context
bdk_testenv depending on electrsd is reasonable for integration tests. It is surprising for this example, because the example talks to an already-running Signet bitcoind and does not start a regtest node.
This is a build/developer-experience issue, not a runtime bug in FilterIter.
Related but different:
- #1618 / PR #2329 — CI coverage for the example path on Ubuntu
- #2268 —
FilterItersafety
HIi @notmandatory , I’m Naitik! I’m a CSE student and an open-source enthusiast. I’ve been contributing to different open-source projects for a while and recently started getting more interested in the Bitcoin ecosystem.
I’m familiar with Rust and wanted to get more hands-on with Bitcoin development, which is what brought me to BDK. Instead of just going through the code, I recently tried using BDK from a real developer/user perspective and built a small Signet app using bdk_chain, bdk_esplora and bdk_file_store.
While going through the actual workflow, I also ran into a small Windows build issue with the filter_iter example and opened #2338 with the reproduction details.
I’m still getting familiar with BDK and the Bitcoin ecosystem, but I’d really like to contribute here and learn from the community. Looking forward to getting involved!
Is your proposal to change the examples to import anyhow directly and not import bdk_testenv? If so please try this out and confirm if that approach works. Most of the folks contributing to this project use linux or macOS systems and so we cannot reproduce this issue.
heyy @notmandatory ....I tried the approach you suggested on Windows like i changed filter_iter to use anyhow directly and added anyhow as a dev-dependency but the example still doesn't compile.It looks like bdk_testenv is still being pulled in because it's a package-level dev-dependency......which brings in electrsd and causes the same Unix-specific build error on Windows......so
So the direct anyhow change works at the import level......but isn't enough to fix the Windows build by itself.....you can suggest what should be done ......and I can look into how to keep bdk_testenv out of this example's dependency graph if you think that's the right direction.