From c39144597de2da7482c2ddfd5309d8630ea8bedc Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 1 May 2024 12:17:39 +1000 Subject: [PATCH] Add verifymessage feature In #326 we changed a function to use `bitcoin::sign_message::MessageSignature` but doing so requires the "base64" feature to be on for `bitcoin`. This did not get caught by CI but improvements to CI in #338 will now catch this. Add a feature to `json` and `client` that allows enabling "base64" if the `verifymessage` RPC call is required. --- client/Cargo.toml | 10 ++++++++++ client/src/client.rs | 1 + integration_test/Cargo.toml | 2 +- json/Cargo.toml | 3 +++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/Cargo.toml b/client/Cargo.toml index cb2573d1..4f1f67ea 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -18,6 +18,9 @@ edition = "2018" name = "bitcoincore_rpc" path = "src/lib.rs" +[features] +verifymessage = ["bitcoincore-rpc-json/verifymessage"] + [dependencies] bitcoincore-rpc-json = { version = "0.18.0", path = "../json" } @@ -31,3 +34,10 @@ serde_json = "1" [dev-dependencies] tempfile = "3.3.0" +[[example]] +name = "retry_client" +required-features = ["verifymessage"] + +[[example]] +name = "test_against_node" +required-features = [] diff --git a/client/src/client.rs b/client/src/client.rs index 5a917903..4e1e5a49 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -871,6 +871,7 @@ pub trait RpcApi: Sized { self.call("stop", &[]) } + #[cfg(feature = "verifymessage")] fn verify_message( &self, address: &Address, diff --git a/integration_test/Cargo.toml b/integration_test/Cargo.toml index 8ad6c1b5..9b4a8b5e 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 = ["verifymessage"] } bitcoin = { version = "0.31.0", features = ["serde", "rand", "base64"]} lazy_static = "1.4.0" log = "0.4" diff --git a/json/Cargo.toml b/json/Cargo.toml index 8f3d67cc..ebf2f1d0 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -19,6 +19,9 @@ rust-version = "1.56.1" name = "bitcoincore_rpc_json" path = "src/lib.rs" +[features] +verifymessage = ["bitcoin/base64"] + [dependencies] serde = { version = "1", features = [ "derive" ] } serde_json = "1"