From af66cfe3a38db54716255ffe13323efccd54c97e Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 1 May 2024 10:22:57 +1000 Subject: [PATCH] Add rand feature Currently we activate the "bitcoin/rand-std" feature unconditionally in `json`. Some users may not wish to use the bitcoin "rand" feature. Add a "rand" feature to `json` and `client` and use it to activate "rand-std" in `bitcoin`. The crates currently have no features, this is the first. In order to be less of a breaking change also add a "default" feature and enable "rand" from "default". --- client/Cargo.toml | 4 ++++ integration_test/Cargo.toml | 2 +- json/Cargo.toml | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/Cargo.toml b/client/Cargo.toml index 65049ef4..37a23381 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -18,6 +18,10 @@ edition = "2018" name = "bitcoincore_rpc" path = "src/lib.rs" +[features] +default = ["rand"] +rand = ["bitcoincore-rpc-json/rand"] + [dependencies] bitcoincore-rpc-json = { version = "0.18.0", path = "../json" } diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index 7cec049e..9103310a 100644 --- a/integration_test/Cargo.toml +++ b/integration_test/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Steven Roose "] edition = "2018" [dependencies] -bitcoincore-rpc = { path = "../client" } +bitcoincore-rpc = { path = "../client", features = ["rand"] } bitcoin = { version = "0.32.0", features = ["serde", "rand"] } lazy_static = "1.4.0" log = "0.4" diff --git a/json/Cargo.toml b/json/Cargo.toml index 0150c632..69d0d405 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -19,8 +19,12 @@ rust-version = "1.56.1" name = "bitcoincore_rpc_json" path = "src/lib.rs" +[features] +default = ["rand"] +rand = ["bitcoin/rand-std"] + [dependencies] serde = { version = "1", features = [ "derive" ] } serde_json = "1" -bitcoin = { version = "0.32.0", features = ["serde", "rand-std"] } +bitcoin = { version = "0.32.0", features = ["serde"] }