Skip to content

Commit 23ffb41

Browse files
committed
rename list_chain_txs to canonical_transactions
1 parent 8048f17 commit 23ffb41

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

crates/bdk/src/wallet/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ impl Wallet {
11031103
{
11041104
self.indexed_graph
11051105
.graph()
1106-
.list_chain_txs(&self.chain, self.chain.tip().block_id())
1106+
.canonical_transactions(&self.chain, self.chain.tip().block_id())
11071107
}
11081108

11091109
/// Return the balance, separated into available, trusted-pending, untrusted-pending and immature

crates/chain/src/tx_graph.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -977,10 +977,10 @@ impl<A: Anchor> TxGraph<A> {
977977
/// If the [`ChainOracle`] implementation (`chain`) fails, an error will be returned with the
978978
/// returned item.
979979
///
980-
/// If the [`ChainOracle`] is infallible, [`list_chain_txs`] can be used instead.
980+
/// If the [`ChainOracle`] is infallible, [`canonical_transactions`] can be used instead.
981981
///
982-
/// [`list_chain_txs`]: Self::list_chain_txs
983-
pub fn try_list_chain_txs<'a, C: ChainOracle + 'a>(
982+
/// [`canonical_transactions`]: Self::canonical_transactions
983+
pub fn try_canonical_transactions<'a, C: ChainOracle + 'a>(
984984
&'a self,
985985
chain: &'a C,
986986
chain_tip: BlockId,
@@ -1001,15 +1001,15 @@ impl<A: Anchor> TxGraph<A> {
10011001

10021002
/// List graph transactions that are in `chain` with `chain_tip`.
10031003
///
1004-
/// This is the infallible version of [`try_list_chain_txs`].
1004+
/// This is the infallible version of [`try_canonical_transactions`].
10051005
///
1006-
/// [`try_list_chain_txs`]: Self::try_list_chain_txs
1007-
pub fn list_chain_txs<'a, C: ChainOracle + 'a>(
1006+
/// [`try_canonical_transactions`]: Self::try_canonical_transactions
1007+
pub fn canonical_transactions<'a, C: ChainOracle + 'a>(
10081008
&'a self,
10091009
chain: &'a C,
10101010
chain_tip: BlockId,
10111011
) -> impl Iterator<Item = CanonicalTx<'a, Arc<Transaction>, A>> {
1012-
self.try_list_chain_txs(chain, chain_tip)
1012+
self.try_canonical_transactions(chain, chain_tip)
10131013
.map(|r| r.expect("oracle is infallible"))
10141014
}
10151015

crates/chain/tests/test_tx_graph_conflicts.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct Scenario<'a> {
1313
name: &'a str,
1414
/// Transaction templates
1515
tx_templates: &'a [TxTemplate<'a, BlockId>],
16-
/// Names of txs that must exist in the output of `list_chain_txs`
16+
/// Names of txs that must exist in the output of `canonical_transactions`
1717
exp_chain_txs: HashSet<&'a str>,
1818
/// Outpoints that must exist in the output of `filter_chain_txouts`
1919
exp_chain_txouts: HashSet<(&'a str, u32)>,
@@ -25,7 +25,7 @@ struct Scenario<'a> {
2525

2626
/// This test ensures that [`TxGraph`] will reliably filter out irrelevant transactions when
2727
/// presented with multiple conflicting transaction scenarios using the [`TxTemplate`] structure.
28-
/// This test also checks that [`TxGraph::list_chain_txs`], [`TxGraph::filter_chain_txouts`],
28+
/// This test also checks that [`TxGraph::canonical_transactions`], [`TxGraph::filter_chain_txouts`],
2929
/// [`TxGraph::filter_chain_unspents`], and [`TxGraph::balance`] return correct data.
3030
#[test]
3131
fn test_tx_conflict_handling() {
@@ -595,7 +595,7 @@ fn test_tx_conflict_handling() {
595595
let (tx_graph, spk_index, exp_tx_ids) = init_graph(scenario.tx_templates.iter());
596596

597597
let txs = tx_graph
598-
.list_chain_txs(&local_chain, chain_tip)
598+
.canonical_transactions(&local_chain, chain_tip)
599599
.map(|tx| tx.tx_node.txid)
600600
.collect::<BTreeSet<_>>();
601601
let exp_txs = scenario
@@ -605,7 +605,7 @@ fn test_tx_conflict_handling() {
605605
.collect::<BTreeSet<_>>();
606606
assert_eq!(
607607
txs, exp_txs,
608-
"\n[{}] 'list_chain_txs' failed",
608+
"\n[{}] 'canonical_transactions' failed",
609609
scenario.name
610610
);
611611

example-crates/example_electrum/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ fn main() -> anyhow::Result<()> {
264264
if unconfirmed {
265265
let unconfirmed_txids = graph
266266
.graph()
267-
.list_chain_txs(&*chain, chain_tip)
267+
.canonical_transactions(&*chain, chain_tip)
268268
.filter(|canonical_tx| !canonical_tx.chain_position.is_confirmed())
269269
.map(|canonical_tx| canonical_tx.tx_node.txid)
270270
.collect::<Vec<Txid>>();

example-crates/example_esplora/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ fn main() -> anyhow::Result<()> {
315315
// `EsploraExt::update_tx_graph_without_keychain`.
316316
let unconfirmed_txids = graph
317317
.graph()
318-
.list_chain_txs(&*chain, local_tip.block_id())
318+
.canonical_transactions(&*chain, local_tip.block_id())
319319
.filter(|canonical_tx| !canonical_tx.chain_position.is_confirmed())
320320
.map(|canonical_tx| canonical_tx.tx_node.txid)
321321
.collect::<Vec<Txid>>();

0 commit comments

Comments
 (0)