From fd14a2e7ba63ee37d6af54132fad2b6f83aa1196 Mon Sep 17 00:00:00 2001 From: Luis Schwab Date: Fri, 3 Jul 2026 15:45:36 -0300 Subject: [PATCH 1/2] chore!: remove deprecated `BlockSummary` and `get_block` --- CHANGELOG.md | 8 ++++++++ src/api.rs | 19 ------------------- src/async.rs | 24 ------------------------ src/blocking.rs | 24 ------------------------ tests/block.rs | 34 ---------------------------------- 5 files changed, 8 insertions(+), 101 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26556ad..9e05a5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## [Unreleased] +### Added + +### Changed + +* chore!: remove deprecated `BlockSummary` and `get_block` [#225] + +### Fixed + ## [0.13.0] – 2026-06-28 ### Added diff --git a/src/api.rs b/src/api.rs index dec30f8..474b479 100644 --- a/src/api.rs +++ b/src/api.rs @@ -14,7 +14,6 @@ use std::collections::HashMap; pub use bitcoin::consensus::{deserialize, serialize}; use bitcoin::hash_types; -use bitcoin::hash_types::TxMerkleNode; pub use bitcoin::hex::FromHex; pub use bitcoin::{ absolute, block, transaction, Address, Amount, Block, BlockHash, CompactTarget, FeeRate, @@ -211,24 +210,6 @@ pub struct BlockTime { pub height: u32, } -/// Summary about a [`Block`]. -#[allow(deprecated)] -#[deprecated(since = "0.13.0", note = "use `BlockInfo` instead")] -#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] -pub struct BlockSummary { - /// The [`BlockHash`] of the [`Block`]. - pub id: BlockHash, - /// The UNIX timestamp and height of the [`Block`]. - #[serde(flatten)] - pub time: BlockTime, - /// The [`BlockHash`] of the previous [`Block`]. - /// - /// `None` for the genesis block. - pub previousblockhash: Option, - /// The Merkle root of this [`Block`]. - pub merkle_root: TxMerkleNode, -} - /// Statistics about an [`Address`]. #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub struct AddressStats { diff --git a/src/async.rs b/src/async.rs index d8f8ed7..9e14400 100644 --- a/src/async.rs +++ b/src/async.rs @@ -51,9 +51,6 @@ use crate::{ OutputStatus, ScriptHashStats, SubmitPackageResult, TxStatus, Utxo, BASE_BACKOFF_MILLIS, }; -#[allow(deprecated)] -use crate::BlockSummary; - // FIXME: (@oleonardolima) there's no `Debug` implementation for `bitreq::Client`. /// An async client for interacting with an Esplora API server. /// @@ -687,27 +684,6 @@ impl AsyncClient { self.get_response_json(&path).await } - /// Get [`BlockInfo`] summaries for recent [`Block`]s. - /// - /// If `height` is `Some(h)`, returns blocks starting from height `h`. - /// If `height` is `None`, returns blocks starting from the current tip. - /// - /// The maximum number of summaries returned depends on the backend itself: - /// Esplora returns `10` while [mempool.space](https://mempool.space/docs/api) returns `15`. - #[allow(deprecated)] - #[deprecated(since = "0.13.0", note = "use `get_block_infos` instead")] - pub async fn get_blocks(&self, height: Option) -> Result, Error> { - let path = match height { - Some(height) => format!("/blocks/{height}"), - None => "/blocks".to_string(), - }; - let blocks: Vec = self.get_response_json(&path).await?; - if blocks.is_empty() { - return Err(Error::InvalidResponse); - } - Ok(blocks) - } - /// Get [`BlockInfo`] summaries for recent [`Block`]s. /// /// If `height` is `Some(h)`, returns blocks starting from height `h`. diff --git a/src/blocking.rs b/src/blocking.rs index 8249245..11e8091 100644 --- a/src/blocking.rs +++ b/src/blocking.rs @@ -48,9 +48,6 @@ use crate::{ OutputStatus, ScriptHashStats, SubmitPackageResult, TxStatus, Utxo, BASE_BACKOFF_MILLIS, }; -#[allow(deprecated)] -use crate::BlockSummary; - /// A synchronous client for interacting with an Esplora API server. /// /// Use [`Builder`] to construct an instance of this client. The client stores @@ -639,27 +636,6 @@ impl BlockingClient { self.get_response_json(&path) } - /// Get [`BlockInfo`] summaries for recent [`Block`]s. - /// - /// If `height` is `Some(h)`, returns blocks starting from height `h`. - /// If `height` is `None`, returns blocks starting from the current tip. - /// - /// The maximum number of summaries returned depends on the backend itself: - /// Esplora returns `10` while [mempool.space](https://mempool.space/docs/api) returns `15`. - #[allow(deprecated)] - #[deprecated(since = "0.13.0", note = "use `get_block_infos` instead")] - pub fn get_blocks(&self, height: Option) -> Result, Error> { - let path = match height { - Some(height) => format!("/blocks/{height}"), - None => "/blocks".to_string(), - }; - let blocks: Vec = self.get_response_json(&path)?; - if blocks.is_empty() { - return Err(Error::InvalidResponse); - } - Ok(blocks) - } - /// Get [`BlockInfo`] summaries for recent [`Block`]s. /// /// If `height` is `Some(h)`, returns blocks starting from height `h`. diff --git a/tests/block.rs b/tests/block.rs index 73b767d..ee88d13 100644 --- a/tests/block.rs +++ b/tests/block.rs @@ -201,40 +201,6 @@ async fn test_get_block_txs() { assert_eq!(txs_blocking.len(), txs_async.len()); } -#[allow(deprecated)] -#[tokio::test] -async fn test_get_blocks() { - let env = TestEnv::new(); - let (blocking_client, async_client) = env.setup_clients(); - - let start_height = env.bitcoind_client().get_block_count().unwrap().0; - let blocks1 = blocking_client.get_blocks(None).unwrap(); - let blocks_async1 = async_client.get_blocks(None).await.unwrap(); - assert_eq!(blocks1[0].time.height, start_height as u32); - assert_eq!(blocks1, blocks_async1); - env.mine_and_wait(1); - - let blocks2 = blocking_client.get_blocks(None).unwrap(); - let blocks_async2 = async_client.get_blocks(None).await.unwrap(); - assert_eq!(blocks2, blocks_async2); - assert_ne!(blocks2, blocks1); - - let blocks3 = blocking_client - .get_blocks(Some(start_height as u32)) - .unwrap(); - let blocks_async3 = async_client - .get_blocks(Some(start_height as u32)) - .await - .unwrap(); - assert_eq!(blocks3, blocks_async3); - assert_eq!(blocks3[0].time.height, start_height as u32); - assert_eq!(blocks3, blocks1); - - let blocks_genesis = blocking_client.get_blocks(Some(0)).unwrap(); - let blocks_genesis_async = async_client.get_blocks(Some(0)).await.unwrap(); - assert_eq!(blocks_genesis, blocks_genesis_async); -} - #[tokio::test] async fn test_get_block_info() { let env = TestEnv::new(); From 32f76dae016fa74ec00d0d0276d2833b60ad4d5d Mon Sep 17 00:00:00 2001 From: Luis Schwab Date: Fri, 3 Jul 2026 15:54:41 -0300 Subject: [PATCH 2/2] chore: bump Rust toolchains --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 61ed64b..aef30fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,8 +57,8 @@ blocking-https-rustls = ["blocking", "bitreq/https-rustls"] blocking-https-rustls-probe = ["blocking", "bitreq/https-rustls-probe"] [package.metadata.rbmt.toolchains] -stable = "1.96.0" -nightly = "nightly-2026-05-08" +stable = "1.96.1" +nightly = "nightly-2026-07-03" [package.metadata.docs.rs] all-features = true