Skip to content

Commit b82a07b

Browse files
committed
2 parents dc22fce + 900d508 commit b82a07b

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

.github/workflows/cont_integration.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ jobs:
6363
cargo update -p ring --precise "0.17.12"
6464
cargo update -p flate2 --precise "1.0.35"
6565
cargo update -p once_cell --precise "1.20.3"
66+
cargo update -p tracing-core --precise "0.1.33"
67+
cargo update -p parking_lot --precise "0.12.3"
68+
cargo update -p parking_lot_core --precise "0.9.10"
69+
cargo update -p lock_api --precise "0.4.12"
6670
6771
cargo update -p base64ct --precise "1.6.0" # dev-dependency
6872
cargo update -p bzip2-sys --precise "0.1.12+1.0.8" # dev-dependency

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ cargo update -p native-tls --precise "0.2.13"
3131
cargo update -p ring --precise "0.17.12"
3232
cargo update -p flate2 --precise "1.0.35"
3333
cargo update -p once_cell --precise "1.20.3"
34+
cargo update -p tracing-core --precise "0.1.33"
35+
cargo update -p parking_lot --precise "0.12.3"
36+
cargo update -p parking_lot_core --precise "0.9.10"
37+
cargo update -p lock_api --precise "0.4.12"
3438
```

src/async.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ impl<S: Sleeper> AsyncClient<S> {
415415
) -> Result<Vec<Tx>, Error> {
416416
let script_hash = sha256::Hash::hash(script.as_bytes());
417417
let path = match last_seen {
418-
Some(last_seen) => format!("/scripthash/{:x}/txs/chain/{}", script_hash, last_seen),
419-
None => format!("/scripthash/{:x}/txs", script_hash),
418+
Some(last_seen) => format!("/scripthash/{script_hash:x}/txs/chain/{last_seen}"),
419+
None => format!("/scripthash/{script_hash:x}/txs"),
420420
};
421421

422422
self.get_response_json(&path).await

src/blocking.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl BlockingClient {
197197

198198
/// Get a [`Transaction`] option given its [`Txid`]
199199
pub fn get_tx(&self, txid: &Txid) -> Result<Option<Transaction>, Error> {
200-
self.get_opt_response(&format!("/tx/{}/raw", txid))
200+
self.get_opt_response(&format!("/tx/{txid}/raw"))
201201
}
202202

203203
/// Get a [`Transaction`] given its [`Txid`].
@@ -216,44 +216,44 @@ impl BlockingClient {
216216
block_hash: &BlockHash,
217217
index: usize,
218218
) -> Result<Option<Txid>, Error> {
219-
self.get_opt_response_txid(&format!("/block/{}/txid/{}", block_hash, index))
219+
self.get_opt_response_txid(&format!("/block/{block_hash}/txid/{index}"))
220220
}
221221

222222
/// Get the status of a [`Transaction`] given its [`Txid`].
223223
pub fn get_tx_status(&self, txid: &Txid) -> Result<TxStatus, Error> {
224-
self.get_response_json(&format!("/tx/{}/status", txid))
224+
self.get_response_json(&format!("/tx/{txid}/status"))
225225
}
226226

227227
/// Get transaction info given it's [`Txid`].
228228
pub fn get_tx_info(&self, txid: &Txid) -> Result<Option<Tx>, Error> {
229-
self.get_opt_response_json(&format!("/tx/{}", txid))
229+
self.get_opt_response_json(&format!("/tx/{txid}"))
230230
}
231231

232232
/// Get a [`BlockHeader`] given a particular block hash.
233233
pub fn get_header_by_hash(&self, block_hash: &BlockHash) -> Result<BlockHeader, Error> {
234-
self.get_response_hex(&format!("/block/{}/header", block_hash))
234+
self.get_response_hex(&format!("/block/{block_hash}/header"))
235235
}
236236

237237
/// Get the [`BlockStatus`] given a particular [`BlockHash`].
238238
pub fn get_block_status(&self, block_hash: &BlockHash) -> Result<BlockStatus, Error> {
239-
self.get_response_json(&format!("/block/{}/status", block_hash))
239+
self.get_response_json(&format!("/block/{block_hash}/status"))
240240
}
241241

242242
/// Get a [`Block`] given a particular [`BlockHash`].
243243
pub fn get_block_by_hash(&self, block_hash: &BlockHash) -> Result<Option<Block>, Error> {
244-
self.get_opt_response(&format!("/block/{}/raw", block_hash))
244+
self.get_opt_response(&format!("/block/{block_hash}/raw"))
245245
}
246246

247247
/// Get a merkle inclusion proof for a [`Transaction`] with the given
248248
/// [`Txid`].
249249
pub fn get_merkle_proof(&self, txid: &Txid) -> Result<Option<MerkleProof>, Error> {
250-
self.get_opt_response_json(&format!("/tx/{}/merkle-proof", txid))
250+
self.get_opt_response_json(&format!("/tx/{txid}/merkle-proof"))
251251
}
252252

253253
/// Get a [`MerkleBlock`] inclusion proof for a [`Transaction`] with the
254254
/// given [`Txid`].
255255
pub fn get_merkle_block(&self, txid: &Txid) -> Result<Option<MerkleBlock>, Error> {
256-
self.get_opt_response_hex(&format!("/tx/{}/merkleblock-proof", txid))
256+
self.get_opt_response_hex(&format!("/tx/{txid}/merkleblock-proof"))
257257
}
258258

259259
/// Get the spending status of an output given a [`Txid`] and the output
@@ -263,7 +263,7 @@ impl BlockingClient {
263263
txid: &Txid,
264264
index: u64,
265265
) -> Result<Option<OutputStatus>, Error> {
266-
self.get_opt_response_json(&format!("/tx/{}/outspend/{}", txid, index))
266+
self.get_opt_response_json(&format!("/tx/{txid}/outspend/{index}"))
267267
}
268268

269269
/// Broadcast a [`Transaction`] to Esplora
@@ -309,7 +309,7 @@ impl BlockingClient {
309309

310310
/// Get the [`BlockHash`] of a specific block height
311311
pub fn get_block_hash(&self, block_height: u32) -> Result<BlockHash, Error> {
312-
self.get_response_str(&format!("/block-height/{}", block_height))
312+
self.get_response_str(&format!("/block-height/{block_height}"))
313313
.map(|s| BlockHash::from_str(s.as_str()).map_err(Error::HexToArray))?
314314
}
315315

@@ -354,8 +354,8 @@ impl BlockingClient {
354354
) -> Result<Vec<Tx>, Error> {
355355
let script_hash = sha256::Hash::hash(script.as_bytes());
356356
let path = match last_seen {
357-
Some(last_seen) => format!("/scripthash/{:x}/txs/chain/{}", script_hash, last_seen),
358-
None => format!("/scripthash/{:x}/txs", script_hash),
357+
Some(last_seen) => format!("/scripthash/{script_hash:x}/txs/chain/{last_seen}"),
358+
None => format!("/scripthash/{script_hash:x}/txs"),
359359
};
360360
self.get_response_json(&path)
361361
}
@@ -367,7 +367,7 @@ impl BlockingClient {
367367
/// esplora returns `10` while [mempool.space](https://mempool.space/docs/api) returns `15`.
368368
pub fn get_blocks(&self, height: Option<u32>) -> Result<Vec<BlockSummary>, Error> {
369369
let path = match height {
370-
Some(height) => format!("/blocks/{}", height),
370+
Some(height) => format!("/blocks/{height}"),
371371
None => "/blocks".to_string(),
372372
};
373373
let blocks: Vec<BlockSummary> = self.get_response_json(&path)?;

src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
//! * `async-https-rustls-manual-roots` enables [`reqwest`], the async client with support for
6464
//! proxying and TLS (SSL) using the `rustls` TLS backend without using its the default root
6565
//! certificates.
66-
66+
//!
67+
//! [`dont remove this line or cargo doc will break`]: https://example.com
68+
#![cfg_attr(not(feature = "minreq"), doc = "[`minreq`]: https://docs.rs/minreq")]
69+
#![cfg_attr(not(feature = "reqwest"), doc = "[`reqwest`]: https://docs.rs/reqwest")]
6770
#![allow(clippy::result_large_err)]
6871

6972
use std::collections::HashMap;
@@ -87,7 +90,7 @@ pub use blocking::BlockingClient;
8790
pub use r#async::AsyncClient;
8891

8992
/// Response status codes for which the request may be retried.
90-
const RETRYABLE_ERROR_CODES: [u16; 3] = [
93+
pub const RETRYABLE_ERROR_CODES: [u16; 3] = [
9194
429, // TOO_MANY_REQUESTS
9295
500, // INTERNAL_SERVER_ERROR
9396
503, // SERVICE_UNAVAILABLE
@@ -233,7 +236,7 @@ pub enum Error {
233236

234237
impl fmt::Display for Error {
235238
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
236-
write!(f, "{:?}", self)
239+
write!(f, "{self:?}")
237240
}
238241
}
239242

@@ -325,14 +328,14 @@ mod test {
325328

326329
let esplora_url = ELECTRSD.esplora_url.as_ref().unwrap();
327330

328-
let mut builder = Builder::new(&format!("http://{}", esplora_url));
331+
let mut builder = Builder::new(&format!("http://{esplora_url}"));
329332
if !headers.is_empty() {
330333
builder.headers = headers;
331334
}
332335

333336
let blocking_client = builder.build_blocking();
334337

335-
let builder_async = Builder::new(&format!("http://{}", esplora_url));
338+
let builder_async = Builder::new(&format!("http://{esplora_url}"));
336339

337340
#[cfg(feature = "tokio")]
338341
let async_client = builder_async.build_async().unwrap();

0 commit comments

Comments
 (0)