diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 350a128..a7ee31c 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -51,9 +51,8 @@ jobs: if: matrix.rust.version == '1.75.0' run: | cargo update -p minreq --precise "2.13.2" - cargo update -p home --precise "0.5.9" - cargo update -p native-tls --precise "0.2.13" cargo update -p idna_adapter --precise "1.2.0" + cargo update -p native-tls --precise "0.2.13" cargo update -p zerofrom --precise "0.1.5" cargo update -p litemap --precise "0.7.4" - name: Build diff --git a/Cargo.toml b/Cargo.toml index d474ea0..55f51ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ tokio = { version = "1", features = ["time"], optional = true } [dev-dependencies] tokio = { version = "1.20.1", features = ["full"] } -electrsd = { version = "0.33.0", features = ["legacy", "esplora_a33e97e1", "corepc-node_28_0"] } +electrsd = { version = "0.36.1", features = ["legacy", "esplora_a33e97e1", "corepc-node_29_0"] } lazy_static = "1.4.0" [features] diff --git a/README.md b/README.md index 278b66f..61d0acc 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,8 @@ To build with the MSRV you will need to pin dependencies as follows: ```shell cargo update -p minreq --precise "2.13.2" -cargo update -p home --precise "0.5.9" -cargo update -p native-tls --precise "0.2.13" cargo update -p idna_adapter --precise "1.2.0" +cargo update -p native-tls --precise "0.2.13" cargo update -p zerofrom --precise "0.1.5" cargo update -p litemap --precise "0.7.4" ``` diff --git a/src/async.rs b/src/async.rs index 9f8e854..6c6718a 100644 --- a/src/async.rs +++ b/src/async.rs @@ -394,6 +394,11 @@ impl AsyncClient { maxfeerate: Option, maxburnamount: Option, ) -> Result { + let serialized_txs = transactions + .iter() + .map(|tx| serialize_hex(&tx)) + .collect::>(); + let mut queryparams = HashSet::<(&str, String)>::new(); if let Some(maxfeerate) = maxfeerate { queryparams.insert(("maxfeerate", maxfeerate.to_string())); @@ -402,15 +407,10 @@ impl AsyncClient { queryparams.insert(("maxburnamount", maxburnamount.to_string())); } - let serialized_txs = transactions - .iter() - .map(|tx| serialize_hex(&tx)) - .collect::>(); - let response = self .post_request_bytes( "/txs/package", - serde_json::to_string(&serialized_txs).unwrap_or_default(), + serde_json::to_string(&serialized_txs).map_err(Error::SerdeJson)?, Some(queryparams), ) .await?; diff --git a/src/blocking.rs b/src/blocking.rs index 3e68e6c..aa5a8bc 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -332,7 +332,7 @@ impl BlockingClient { let mut request = self.post_request( "/txs/package", serde_json::to_string(&serialized_txs) - .unwrap_or_default() + .map_err(Error::SerdeJson)? .into_bytes(), )?; diff --git a/src/lib.rs b/src/lib.rs index d5bb38c..e56d27c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -204,10 +204,12 @@ impl Builder { pub enum Error { /// Error during `minreq` HTTP request #[cfg(feature = "blocking")] - Minreq(::minreq::Error), - /// Error during reqwest HTTP request + Minreq(minreq::Error), + /// Error during `reqwest` HTTP request #[cfg(feature = "async")] - Reqwest(::reqwest::Error), + Reqwest(reqwest::Error), + /// Error during JSON (de)serialization + SerdeJson(serde_json::Error), /// HTTP response error HttpResponse { /// The HTTP status code returned by the server. @@ -263,6 +265,7 @@ impl std::error::Error for Error {} impl_error!(::minreq::Error, Minreq, Error); #[cfg(feature = "async")] impl_error!(::reqwest::Error, Reqwest, Error); +impl_error!(serde_json::Error, SerdeJson, Error); impl_error!(std::num::ParseIntError, Parsing, Error); impl_error!(bitcoin::consensus::encode::Error, BitcoinEncoding, Error); impl_error!(bitcoin::hex::HexToArrayError, HexToArray, Error);