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

node: Remove default feature #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 0 additions & 2 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ anyhow = "1.0.66"
# - To use --no-default-features you must configure the bitcoind binary to be version 28 either by having `bitcoind` in your path or using `BITCOIND_EXE=/path/to/bitcoind`.
# - `cargo test --no-default-features` uses `v28_0` also.
[features]
default = ["28_0"]

# download is not supposed to be used directly only through selecting one of the version feature
download = ["bitcoin_hashes", "flate2", "tar", "minreq", "zip"]

Expand Down
4 changes: 4 additions & 0 deletions node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ if let Ok(exe_path) = bitcoind::exe_path() {
Startup options could be configured via the [`Conf`] struct using [`Node::with_conf`] or
[`Node::from_downloaded_with_conf`]

*WARNING* In order to get `--no-default-features` to work we hack-ishly default to the latest
supported version of Core. This means that the `bitcoind` binary _must_ be the latest version or
units test will/may fail.

## Features

* Waits until bitcoind daemon becomes ready to accept RPC commands
Expand Down
41 changes: 22 additions & 19 deletions node/src/client_versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,74 @@
// unusual in that it expects exactly one version number feature to be selected, docs.rs is not set
// up to handle such oddity.

#![allow(unused_imports)] // Not all users need the json types.

#[cfg(feature = "28_0")]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v28::{Client, AddressType}, types::v28 as types};

#[cfg(all(feature = "27_2", not(feature = "28_0")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v27::{Client, AddressType}, types::v27 as types};

#[cfg(all(feature = "27_1", not(feature = "27_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v27::{Client, AddressType}, types::v27 as types};

#[cfg(all(feature = "27_0", not(feature = "27_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v27::{Client, AddressType}, types::v27 as types};

#[cfg(all(feature = "26_2", not(feature = "27_0")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v26::{Client, AddressType}, types::v26 as types};

#[cfg(all(feature = "26_1", not(feature = "26_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v26::{Client, AddressType}, types::v26 as types};

#[cfg(all(feature = "26_0", not(feature = "26_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v26::{Client, AddressType}, types::v26 as types};

#[cfg(all(feature = "25_2", not(feature = "26_0")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v25::{Client, AddressType}, types::v25 as types};

#[cfg(all(feature = "24_2", not(feature = "25_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v24::{Client, AddressType}, types::v24 as types};

#[cfg(all(feature = "23_2", not(feature = "24_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v23::{Client, AddressType}, types::v23 as types};

#[cfg(all(feature = "22_1", not(feature = "23_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v22::{Client, AddressType}, types::v22 as types};

#[cfg(all(feature = "0_21_2", not(feature = "22_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v21::{Client, AddressType}, types::v21 as types};

#[cfg(all(feature = "0_20_2", not(feature = "0_21_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v20::{Client, AddressType}, types::v20 as types};

#[cfg(all(feature = "0_19_1", not(feature = "0_20_2")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v19::{Client, AddressType}, types::v19 as types};

#[cfg(all(feature = "0_18_1", not(feature = "0_19_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v18::{Client, AddressType}, types::v18 as types};

#[cfg(all(feature = "0_17_1", not(feature = "0_18_1")))]
#[allow(unused_imports)] // Not all users need the json types.
pub use corepc_client::{client_sync::v17::{Client, AddressType}, types::v17 as types};

// To make --no-default-features work we have to re-export a the types, use most recent version same as we do for all features.
#[cfg(all(not(feature = "28_0"), not(feature = "27_1"), not(feature = "27_0"), not(feature = "26_2"), not(feature = "26_1"), not(feature = "26_0"), not(feature = "25_2"), not(feature = "24_2"), not(feature = "23_2"), not(feature = "22_1"), not(feature = "0_21_2"), not(feature = "0_20_2"), not(feature = "0_19_1"), not(feature = "0_18_1"), not(feature = "0_17_1")))]
#[allow(unused_imports)] // Not all users need the json types.
// To make --no-default-features work we have to re-export _some_ types.
// This must be in sync with the `VERSION` string in `./versions.rs`.
#[cfg(all(
not(feature = "28_0"),
not(feature = "27_2"),
not(feature = "27_1"),
not(feature = "27_0"),
not(feature = "26_2"),
not(feature = "26_1"),
not(feature = "26_0"),
not(feature = "25_2"),
not(feature = "24_2"),
not(feature = "23_2"),
not(feature = "22_1"),
not(feature = "0_21_2"),
not(feature = "0_20_2"),
not(feature = "0_19_1"),
not(feature = "0_18_1"),
not(feature = "0_17_1")
))]
pub use corepc_client::{client_sync::v28::{Client, AddressType}, types::v28 as types};
4 changes: 3 additions & 1 deletion node/src/versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ pub const VERSION: &str = "0.18.1";
#[cfg(all(feature = "0_17_1", not(feature = "0_18_1")))]
pub const VERSION: &str = "0.17.1";

// To make --no-default-features work we have to enable some feature, use most recent version same as for default.
// To make --no-default-features work we have to export _some_ VERSION;
// This must be in sync with `./client_versions.rs` re-exports.
#[cfg(all(
not(feature = "28_0"),
not(feature = "27_2"),
not(feature = "27_1"),
not(feature = "27_0"),
not(feature = "26_2"),
Expand Down
Loading