Skip to content

Commit

Permalink
Add verifymessage feature
Browse files Browse the repository at this point in the history
In rust-bitcoin#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 rust-bitcoin#338 will now catch this.

Add a feature to `json` and `client` that allows enabling "base64" if
the `verifymessage` RPC call is required.
  • Loading branch information
tcharding committed May 1, 2024
1 parent 2d06bca commit dcaa5ca
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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" }

Expand All @@ -32,3 +35,10 @@ serde_json = "1"
[dev-dependencies]
tempfile = "3.3.0"

[[example]]
name = "retry_client"
required-features = ["verifymessage"]

[[example]]
name = "test_against_node"
required-features = []
1 change: 1 addition & 0 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ pub trait RpcApi: Sized {
self.call("stop", &[])
}

#[cfg(feature = "verifymessage")]
fn verify_message(
&self,
address: &Address,
Expand Down
2 changes: 1 addition & 1 deletion integration_test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Steven Roose <steven@stevenroose.org>", "Tobin C. Harding <me@tobin.
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"
3 changes: 3 additions & 0 deletions json/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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"
Expand Down

0 comments on commit dcaa5ca

Please sign in to comment.