Skip to content

Commit 84da746

Browse files
committed
Revert breaking changes to jsonrpc sync client
Restore the original sync client feature name, module name and reexports so that downstream is not broken.
1 parent 7a45f6f commit 84da746

15 files changed

Lines changed: 36 additions & 34 deletions

File tree

.github/workflows/cron-daily-fuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# We only get 20 jobs at a time, we probably don't want to go
1919
# over that limit with fuzzing because of the hour run time.
2020
fuzz_target: [
21-
bitreq_http_sync,
21+
bitreq_http,
2222
simple_http,
2323
]
2424
steps:

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1818

1919
[features]
2020
# Enable this feature to get a blocking JSON-RPC client.
21-
client-sync = ["jsonrpc", "jsonrpc/bitreq_http_sync"]
21+
client-sync = ["jsonrpc", "jsonrpc/bitreq_http"]
2222
# Enable this feature to get an async JSON-RPC client.
2323
client-async = ["jsonrpc", "jsonrpc/bitreq_http_async", "jsonrpc/client_async"]
2424

client/src/client_sync/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ macro_rules! define_jsonrpc_bitreq_client {
6666

6767
/// Client implements a JSON-RPC client for the Bitcoin Core daemon or compatible APIs.
6868
pub struct Client {
69-
inner: jsonrpc::client_sync::Client,
69+
inner: jsonrpc::client::Client,
7070
}
7171

7272
impl fmt::Debug for Client {
@@ -81,12 +81,12 @@ macro_rules! define_jsonrpc_bitreq_client {
8181
impl Client {
8282
/// Creates a client to a bitcoind JSON-RPC server without authentication.
8383
pub fn new(url: &str) -> Self {
84-
let transport = jsonrpc::http::bitreq_http_sync::Builder::new()
84+
let transport = jsonrpc::http::bitreq_http::Builder::new()
8585
.url(url)
8686
.expect("jsonrpc v0.19, this function does not error")
8787
.timeout(std::time::Duration::from_secs(60))
8888
.build();
89-
let inner = jsonrpc::client_sync::Client::with_transport(transport);
89+
let inner = jsonrpc::client::Client::with_transport(transport);
9090

9191
Self { inner }
9292
}
@@ -98,13 +98,13 @@ macro_rules! define_jsonrpc_bitreq_client {
9898
}
9999
let (user, pass) = auth.get_user_pass()?;
100100

101-
let transport = jsonrpc::http::bitreq_http_sync::Builder::new()
101+
let transport = jsonrpc::http::bitreq_http::Builder::new()
102102
.url(url)
103103
.expect("jsonrpc v0.19, this function does not error")
104104
.timeout(std::time::Duration::from_secs(60))
105105
.basic_auth(user.unwrap(), pass)
106106
.build();
107-
let inner = jsonrpc::client_sync::Client::with_transport(transport);
107+
let inner = jsonrpc::client::Client::with_transport(transport);
108108

109109
Ok(Self { inner })
110110
}

fuzz/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cargo-fuzz = true
1111

1212
[dependencies]
1313
honggfuzz = { version = "0.5.55", default-features = false }
14-
jsonrpc = { path = "../jsonrpc", features = ["bitreq_http_sync"] }
14+
jsonrpc = { path = "../jsonrpc", features = ["bitreq_http"] }
1515

1616
serde = { version = "1.0.103", features = [ "derive" ] }
1717
serde_json = "1.0"
@@ -20,8 +20,8 @@ serde_json = "1.0"
2020
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(fuzzing)', 'cfg(jsonrpc_fuzz)'] }
2121

2222
[[bin]]
23-
name = "bitreq_http_sync"
24-
path = "fuzz_targets/bitreq_http_sync.rs"
23+
name = "bitreq_http"
24+
path = "fuzz_targets/bitreq_http.rs"
2525

2626
[[bin]]
2727
name = "simple_http"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn do_test(data: &[u8]) {
88
{
99
use std::io;
1010

11-
use jsonrpc::bitreq_http_sync::{BitreqHttpTransport, FUZZ_TCP_SOCK};
11+
use jsonrpc::bitreq_http::{BitreqHttpTransport, FUZZ_TCP_SOCK};
1212
use jsonrpc::Client;
1313

1414
*FUZZ_TCP_SOCK.lock().unwrap() = Some(io::Cursor::new(data.to_vec()));

fuzz/generate-files.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cargo-fuzz = true
2323
2424
[dependencies]
2525
honggfuzz = { version = "0.5.55", default-features = false }
26-
jsonrpc = { path = "..", features = ["bitreq_http_sync"] }
26+
jsonrpc = { path = "..", features = ["bitreq_http"] }
2727
2828
serde = { version = "1.0.103", features = [ "derive" ] }
2929
serde_json = "1.0"

jsonrpc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ default = [ "simple_http", "simple_tcp" ]
2121
# A bare-minimum HTTP transport.
2222
simple_http = [ "base64" ]
2323
# A transport that uses `bitreq` as the HTTP client.
24-
bitreq_http_sync = [ "base64", "bitreq" ]
24+
bitreq_http = [ "base64", "bitreq" ]
2525
# A transport that uses `bitreq` as the async HTTP client.
2626
bitreq_http_async = [ "base64", "bitreq", "bitreq/async", "client_async" ]
2727
# An async JSON-RPC client implementation.

jsonrpc/contrib/test_vars.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
FEATURES_WITH_STD=""
55

66
# So this is the var to use for all tests.
7-
FEATURES_WITHOUT_STD="simple_http bitreq_http_sync simple_tcp simple_uds proxy"
7+
FEATURES_WITHOUT_STD="simple_http bitreq_http simple_tcp simple_uds proxy"
88

99
# Run these examples.
1010
EXAMPLES=""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl Client {
124124
}
125125
}
126126

127-
impl fmt::Debug for Client {
127+
impl fmt::Debug for crate::Client {
128128
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
129129
write!(f, "jsonrpc::Client(")?;
130130
self.transport.fmt_target(f)?;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! This module implements the [`crate::client_sync::Transport`] trait using [`bitreq`]
1+
//! This module implements the [`crate::client::Transport`] trait using [`bitreq`]
22
//! as the underlying HTTP transport.
33
//!
44
//! [bitreq]: <https://github.com/rust-bitcoin/corepc/bitreq>
@@ -13,7 +13,7 @@ use std::{error, fmt};
1313
use base64::engine::general_purpose::STANDARD as BASE64;
1414
use base64::Engine;
1515

16-
use crate::client_sync::Transport;
16+
use crate::client::Transport;
1717
use crate::{Request, Response};
1818

1919
const DEFAULT_URL: &str = "http://localhost";
@@ -137,7 +137,7 @@ impl Builder {
137137
/// # Examples
138138
///
139139
/// ```no_run
140-
/// # use jsonrpc::bitreq_http_sync::BitreqHttpTransport;
140+
/// # use jsonrpc::bitreq_http::BitreqHttpTransport;
141141
/// # use std::fs::{self, File};
142142
/// # use std::path::Path;
143143
/// # let cookie_file = Path::new("~/.bitcoind/.cookie");
@@ -259,7 +259,7 @@ mod impls {
259259
#[cfg(test)]
260260
mod tests {
261261
use super::*;
262-
use crate::client_sync::Client;
262+
use crate::Client;
263263

264264
#[test]
265265
fn construct() {

0 commit comments

Comments
 (0)