]> Untitled Git - bdk/commitdiff
fix(bitcoind_rpc): allow filter_iter example to compile on Windows
authorRavindra Kumar Bundela <ravindrabundela1205@gmail.com>
Mon, 19 Oct 2026 11:38:28 +0000 (17:08 +0530)
committer志宇 <hello@evanlinjin.me>
Mon, 19 Oct 2026 12:22:49 +0000 (12:22 +0000)
The filter_iter example previously imported anyhow indirectly from
bdk_testenv. Because Cargo includes package dev-dependencies when
building examples, having bdk_testenv as an unconditional
dev-dependency pulled in electrsd, whose build script relies on Unix
permissions (std::os::unix::fs::PermissionsExt) and fails on Windows.

This change:
- Adds anyhow directly to [dev-dependencies] for bdk_bitcoind_rpc.
- Removes the indirect bdk_testenv::anyhow import in filter_iter.rs.
- Moves bdk_testenv to [target.'cfg(not(windows))'.dev-dependencies].
- Conditionally gates the bdk_testenv-dependent tests on not(windows).

Closes #2338.

crates/bitcoind_rpc/Cargo.toml
crates/bitcoind_rpc/examples/filter_iter.rs
crates/bitcoind_rpc/src/lib.rs
crates/bitcoind_rpc/tests/test_emitter.rs
crates/bitcoind_rpc/tests/test_filter_iter.rs

index 572d1f52304fd5c48458c43f8212117a317c377b..0df0c56f1f53f0ed776423985152e1ba25e406ff 100644 (file)
@@ -21,10 +21,15 @@ bitcoincore-rpc = { version = "0.19.0" }
 bdk_core = { path = "../core", version = "0.6.1", default-features = false }
 
 [dev-dependencies]
+anyhow = "1"
 bdk_bitcoind_rpc = { path = "." }
-bdk_testenv = { path = "../testenv" }
 bdk_chain = { path = "../chain" }
 
+# electrsd's build script (via bdk_testenv) doesn't compile on Windows. Drop this gate, and the
+# tests' `cfg(not(windows))`, once it does.
+[target.'cfg(not(windows))'.dev-dependencies]
+bdk_testenv = { path = "../testenv" }
+
 [features]
 default = ["std"]
 std = ["bitcoin/std", "bdk_core/std"]
index a346a2db0ece87ec3e2821f2860e6d6ef103b9c0..7719b87c5f75d8023cf72d4cb12326f18f3e34a8 100644 (file)
@@ -8,7 +8,6 @@ use bdk_chain::indexer::keychain_txout::KeychainTxOutIndex;
 use bdk_chain::local_chain::LocalChain;
 use bdk_chain::miniscript::Descriptor;
 use bdk_chain::{ConfirmationBlockTime, IndexedTxGraph, SpkIterator};
-use bdk_testenv::anyhow;
 
 // This example shows how BDK chain and tx-graph structures are updated using compact
 // filters syncing. Assumes a connection can be made to a bitcoin node via environment
index 9ab4bd19241bad10ff7d16236aa5129f676dca9b..d9452495f53c5c6656ecd594047638b3b54da0f6 100644 (file)
@@ -461,7 +461,7 @@ impl BitcoindRpcErrorExt for bitcoincore_rpc::Error {
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, not(windows)))]
 #[cfg_attr(coverage_nightly, coverage(off))]
 mod test {
     use crate::{Emitter, NO_EXPECTED_MEMPOOL_TXS};
index f1853cfa44bd3fd4c4f3dbd24e73c71ae6ed1b69..499926392e28fcde87e12402e40cc6c64a176476 100644 (file)
@@ -1,3 +1,5 @@
+#![cfg(not(windows))]
+
 use std::{collections::BTreeSet, ops::Deref};
 
 use bdk_bitcoind_rpc::{Emitter, NO_EXPECTED_MEMPOOL_TXS};
index d6136ecfbc79ed675500e367812f1bdcf92c8fd8..ee672720597fdca62cf49096a00532ef117188e8 100644 (file)
@@ -1,3 +1,5 @@
+#![cfg(not(windows))]
+
 use bdk_bitcoind_rpc::bip158::{Error, FilterIter};
 use bdk_core::CheckPoint;
 use bdk_testenv::{anyhow, bitcoind, TestEnv};