diff --git a/src/async.rs b/src/async.rs index 2a6cf52..9f8e854 100644 --- a/src/async.rs +++ b/src/async.rs @@ -410,7 +410,7 @@ impl AsyncClient { let response = self .post_request_bytes( "/txs/package", - serde_json::to_string(&serialized_txs).unwrap(), + serde_json::to_string(&serialized_txs).unwrap_or_default(), Some(queryparams), ) .await?; diff --git a/src/blocking.rs b/src/blocking.rs index 23425a4..3e68e6c 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -144,7 +144,7 @@ impl BlockingClient { } Ok(resp) => { let hex_str = resp.as_str().map_err(Error::Minreq)?; - let hex_vec = Vec::from_hex(hex_str).unwrap(); + let hex_vec = Vec::from_hex(hex_str)?; deserialize::(&hex_vec) .map_err(Error::BitcoinEncoding) .map(|r| Some(r)) @@ -162,7 +162,7 @@ impl BlockingClient { } Ok(resp) => { let hex_str = resp.as_str().map_err(Error::Minreq)?; - let hex_vec = Vec::from_hex(hex_str).unwrap(); + let hex_vec = Vec::from_hex(hex_str)?; deserialize::(&hex_vec).map_err(Error::BitcoinEncoding) } Err(e) => Err(e), @@ -332,9 +332,8 @@ impl BlockingClient { let mut request = self.post_request( "/txs/package", serde_json::to_string(&serialized_txs) - .unwrap() - .as_bytes() - .to_vec(), + .unwrap_or_default() + .into_bytes(), )?; if let Some(maxfeerate) = maxfeerate {