From 16619bfdd49a1a76a6926e9541eff7a41eb690ce Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 1 May 2024 12:17:39 +1000 Subject: [PATCH 1/2] 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 | 2 ++ integration_test/Cargo.toml | 2 +- json/Cargo.toml | 3 +++ 4 files changed, 16 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..a17bdf85 100644 --- a/client/src/client.rs +++ b/client/src/client.rs @@ -23,6 +23,7 @@ use serde_json; use crate::bitcoin::address::{NetworkUnchecked, NetworkChecked}; use crate::bitcoin::hashes::hex::FromHex; +#[cfg(feature = "verifymessage")] use bitcoin::sign_message::MessageSignature; use crate::bitcoin::{ Address, Amount, Block, OutPoint, PrivateKey, PublicKey, Script, Transaction, @@ -871,6 +872,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" From 56d62dcec14241fbd23d94389333d50bcdd2b39e Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 1 May 2024 12:55:42 +1000 Subject: [PATCH 2/2] CI: Fix pinning MSRV build just broke because of a bunch of dependencies. I did not investigate why I just found a set of versions that builds. --- contrib/test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/test.sh b/contrib/test.sh index e308ce3c..2aa5a279 100755 --- a/contrib/test.sh +++ b/contrib/test.sh @@ -16,7 +16,10 @@ fi # Test pinned versions. if cargo --version | grep ${MSRV}; then cargo update -p tempfile --precise 3.3.0 + cargo update -p cc --precise 1.0.79 cargo update -p log --precise 0.4.18 + cargo update -p serde_json --precise 1.0.96 + cargo update -p serde --precise 1.0.156 fi # Integration test.