Skip to content

Commit 532946a

Browse files
committed
chore(chain): deprecate CanonicalIter, and ChainOracle trait
- add the deprecation warning for both `CanonicalIter` and `ChainOracle` trait, as they're planned to be removed in the future. - add `#[allow(deprecated)] throughout the code to prevent related warnings.
1 parent 1a77475 commit 532946a

5 files changed

Lines changed: 16 additions & 0 deletions

File tree

crates/chain/src/canonical_iter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ pub struct CanonicalizationParams {
2222
}
2323

2424
/// Iterates over canonical txs.
25+
#[deprecated(
26+
since = "0.23.3",
27+
note = "`CanonicalIter` will be removed in a future release, replaced by `CanonicalTask` and `CanonicalViewTask`. See: https://github.com/bitcoindevkit/bdk/pull/2038"
28+
)]
2529
pub struct CanonicalIter<'g, A, C> {
2630
tx_graph: &'g TxGraph<A>,
2731
chain: &'g C,

crates/chain/src/chain_oracle.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ use crate::BlockId;
66
/// is an ancestor of the `chain_tip`.
77
///
88
/// [`is_block_in_chain`]: Self::is_block_in_chain
9+
#[deprecated(
10+
since = "0.23.3",
11+
note = "`ChainOracle` will be removed in a future release, replaced by `ChainQuery` in `bdk_core`. See: https://github.com/bitcoindevkit/bdk/pull/2038"
12+
)]
913
pub trait ChainOracle {
1014
/// Error type.
1115
type Error: core::fmt::Debug;

crates/chain/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,22 @@ mod balance;
3232
pub use balance::*;
3333
mod chain_data;
3434
pub use chain_data::*;
35+
#[allow(deprecated)]
3536
pub mod indexed_tx_graph;
3637
pub use indexed_tx_graph::IndexedTxGraph;
3738
pub mod indexer;
3839
pub use indexer::spk_txout;
3940
pub use indexer::Indexer;
41+
#[allow(deprecated)]
4042
pub mod local_chain;
4143
mod tx_data_traits;
4244
pub use tx_data_traits::*;
45+
#[allow(deprecated)]
4346
pub mod tx_graph;
4447
pub use tx_graph::TxGraph;
4548
mod chain_oracle;
4649
pub use chain_oracle::*;
50+
#[allow(deprecated)]
4751
mod canonical_iter;
4852
pub use canonical_iter::*;
4953

crates/chain/tests/test_tx_graph.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#[macro_use]
44
mod common;
55
use bdk_chain::{collections::*, BlockId, CanonicalizationParams, ConfirmationBlockTime};
6+
#[allow(deprecated)]
67
use bdk_chain::{
78
local_chain::LocalChain,
89
tx_graph::{self, CalculateFeeError},
@@ -754,6 +755,7 @@ fn test_walk_ancestors() {
754755
.walk_ancestors(tx_e0.clone(), |depth, tx| Some((depth, tx)))
755756
.collect::<Vec<_>>(),
756757
// Only traverse unconfirmed ancestors of tx_e0 this time
758+
#[allow(deprecated)]
757759
graph
758760
.walk_ancestors(tx_e0.clone(), |depth, tx| {
759761
let tx_node = graph.get_tx_node(tx.compute_txid())?;

examples/example_cli/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(deprecated)]
2+
13
use bdk_chain::keychain_txout::DEFAULT_LOOKAHEAD;
24
use serde_json::json;
35
use std::cmp;

0 commit comments

Comments
 (0)