Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3c46fe5

Browse files
committedJun 1, 2024··
WIP: Use new rust-bitcoind-json-rpc crate
Use the new `rust-bitcoin-json-rpc` crate for RPC calls. WIP because currently only works for features "0_17_1" and "22_1". ref: https://github.com/tcharding/rust-bitcoind-json-rpc
1 parent 9279882 commit 3c46fe5

File tree

3 files changed

+136
-64
lines changed

3 files changed

+136
-64
lines changed
 

‎Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ edition = "2018"
1111
categories = ["cryptography::cryptocurrencies", "development-tools::testing"]
1212

1313
[dependencies]
14-
bitcoincore-rpc = { version = "0.19", features = ["rand"] }
14+
bitcoind-json-rpc = { version = "0.1", features = ["client-sync"] }
1515
log = "0.4"
1616
which = "4.2.5"
1717
anyhow = "1.0.66"
1818
tempfile = "3"
19+
serde_json = { version = "1.0.117" }
1920

2021
[dev-dependencies]
2122
env_logger = "0.9.0"
@@ -53,3 +54,7 @@ anyhow = "1.0.66"
5354
[package.metadata.docs.rs]
5455
features = ["download", "doc"]
5556
rustdoc-args = ["--cfg", "docsrs"]
57+
58+
[patch.crates-io.bitcoind-json-rpc]
59+
git = "https://github.com/tcharding/rust-bitcoind-json-rpc"
60+

‎src/client.rs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#[cfg(feature = "26_0")] // This is all features.
2+
compile_error!{"bitcoind-json-rpc does not support bitcoind v26_0"}
3+
4+
#[cfg(all(feature = "25_1", not(feature = "26_0")))]
5+
compile_error!{"bitcoind-json-rpc does not support bitcoind v25.1"}
6+
7+
#[cfg(all(feature = "25_0", not(feature = "25_1")))]
8+
compile_error!{"bitcoind-json-rpc does not support bitcoind v25.0"}
9+
10+
#[cfg(all(feature = "24_0_1", not(feature = "25_0")))]
11+
compile_error!{"bitcoind-json-rpc does not support bitcoind v24.0.1"}
12+
13+
#[cfg(all(feature = "23_1", not(feature = "24_0_1")))]
14+
compile_error!{"bitcoind-json-rpc does not support bitcoind v23.1"}
15+
16+
#[cfg(all(feature = "22_1", not(feature = "23_1")))]
17+
#[allow(unused_imports)] // Not all users need the json types.
18+
pub use bitcoind_json_rpc::{client_sync::v22::Client, json::v22 as json};
19+
20+
#[cfg(all(feature = "0_21_2", not(feature = "22_1")))]
21+
compile_error!{"bitcoind-json-rpc does not support bitcoind v22.2"}
22+
23+
#[cfg(all(feature = "0_20_2", not(feature = "0_21_2")))]
24+
compile_error!{"bitcoind-json-rpc does not support bitcoind v0.20.2"}
25+
26+
#[cfg(all(feature = "0_19_1", not(feature = "0_20_2")))]
27+
compile_error!{"bitcoind-json-rpc does not support bitcoind v0.19.1"}
28+
29+
#[cfg(all(feature = "0_18_1", not(feature = "0_19_1")))]
30+
compile_error!{"bitcoind-json-rpc does not support bitcoind v0.18.1"}
31+
32+
#[cfg(all(feature = "0_17_1", not(feature = "0_18_1")))]
33+
#[allow(unused_imports)] // Not all users need the json types.
34+
pub use bitcoind_json_rpc::{client_sync::v17::Client, json::v17 as json};

0 commit comments

Comments
 (0)
Please sign in to comment.