Skip to content

Commit 6f76215

Browse files
committed
ref(tx_graph): Rename list_chain_txs to list_canonical_transactions
1 parent bb40e83 commit 6f76215

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

crates/chain/src/tx_graph.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,10 @@ impl<A: Anchor> TxGraph<A> {
996996
/// If the [`ChainOracle`] implementation (`chain`) fails, an error will be returned with the
997997
/// returned item.
998998
///
999-
/// If the [`ChainOracle`] is infallible, [`list_chain_txs`] can be used instead.
999+
/// If the [`ChainOracle`] is infallible, [`list_canonical_transactions`] can be used instead.
10001000
///
1001-
/// [`list_chain_txs`]: Self::list_chain_txs
1002-
pub fn try_list_chain_txs<'a, C: ChainOracle + 'a>(
1001+
/// [`list_canonical_transactions`]: Self::list_canonical_transactions
1002+
pub fn try_list_canonical_transactions<'a, C: ChainOracle + 'a>(
10031003
&'a self,
10041004
chain: &'a C,
10051005
chain_tip: BlockId,
@@ -1018,15 +1018,15 @@ impl<A: Anchor> TxGraph<A> {
10181018

10191019
/// List graph transactions that are in `chain` with `chain_tip`.
10201020
///
1021-
/// This is the infallible version of [`try_list_chain_txs`].
1021+
/// This is the infallible version of [`try_list_canonical_transactions`].
10221022
///
1023-
/// [`try_list_chain_txs`]: Self::try_list_chain_txs
1024-
pub fn list_chain_txs<'a, C: ChainOracle + 'a>(
1023+
/// [`try_list_canonical_transactions`]: Self::try_list_canonical_transactions
1024+
pub fn list_canonical_transactions<'a, C: ChainOracle + 'a>(
10251025
&'a self,
10261026
chain: &'a C,
10271027
chain_tip: BlockId,
10281028
) -> impl Iterator<Item = CanonicalTx<'a, Arc<Transaction>, A>> {
1029-
self.try_list_chain_txs(chain, chain_tip)
1029+
self.try_list_canonical_transactions(chain, chain_tip)
10301030
.map(|r| r.expect("oracle is infallible"))
10311031
}
10321032

crates/chain/tests/test_tx_graph_conflicts.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct Scenario<'a> {
1515
name: &'a str,
1616
/// Transaction templates
1717
tx_templates: &'a [TxTemplate<'a, BlockId>],
18-
/// Names of txs that must exist in the output of `list_chain_txs`
18+
/// Names of txs that must exist in the output of `list_canonical_transactions`
1919
exp_chain_txs: HashSet<&'a str>,
2020
/// Outpoints that must exist in the output of `filter_chain_txouts`
2121
exp_chain_txouts: HashSet<(&'a str, u32)>,
@@ -27,7 +27,7 @@ struct Scenario<'a> {
2727

2828
/// This test ensures that [`TxGraph`] will reliably filter out irrelevant transactions when
2929
/// presented with multiple conflicting transaction scenarios using the [`TxTemplate`] structure.
30-
/// This test also checks that [`TxGraph::list_chain_txs`], [`TxGraph::filter_chain_txouts`],
30+
/// This test also checks that [`TxGraph::list_canonical_transactions`], [`TxGraph::filter_chain_txouts`],
3131
/// [`TxGraph::filter_chain_unspents`], and [`TxGraph::balance`] return correct data.
3232
#[test]
3333
fn test_tx_conflict_handling() {
@@ -597,7 +597,7 @@ fn test_tx_conflict_handling() {
597597
let (tx_graph, spk_index, exp_tx_ids) = init_graph(scenario.tx_templates.iter());
598598

599599
let txs = tx_graph
600-
.list_chain_txs(&local_chain, chain_tip)
600+
.list_canonical_transactions(&local_chain, chain_tip)
601601
.map(|tx| tx.tx_node.txid)
602602
.collect::<BTreeSet<_>>();
603603
let exp_txs = scenario
@@ -607,7 +607,7 @@ fn test_tx_conflict_handling() {
607607
.collect::<BTreeSet<_>>();
608608
assert_eq!(
609609
txs, exp_txs,
610-
"\n[{}] 'list_chain_txs' failed",
610+
"\n[{}] 'list_canonical_transactions' failed",
611611
scenario.name
612612
);
613613

crates/wallet/src/wallet/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ impl Wallet {
12061206
{
12071207
self.indexed_graph
12081208
.graph()
1209-
.list_chain_txs(&self.chain, self.chain.tip().block_id())
1209+
.list_canonical_transactions(&self.chain, self.chain.tip().block_id())
12101210
}
12111211

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

example-crates/example_electrum/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn main() -> anyhow::Result<()> {
272272
if unconfirmed {
273273
let unconfirmed_txids = graph
274274
.graph()
275-
.list_chain_txs(&*chain, chain_tip.block_id())
275+
.list_canonical_transactions(&*chain, chain_tip.block_id())
276276
.filter(|canonical_tx| !canonical_tx.chain_position.is_confirmed())
277277
.map(|canonical_tx| canonical_tx.tx_node.txid)
278278
.collect::<Vec<Txid>>();

example-crates/example_esplora/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fn main() -> anyhow::Result<()> {
303303
// `EsploraExt::update_tx_graph_without_keychain`.
304304
let unconfirmed_txids = graph
305305
.graph()
306-
.list_chain_txs(&*chain, local_tip.block_id())
306+
.list_canonical_transactions(&*chain, local_tip.block_id())
307307
.filter(|canonical_tx| !canonical_tx.chain_position.is_confirmed())
308308
.map(|canonical_tx| canonical_tx.tx_node.txid)
309309
.collect::<Vec<Txid>>();

0 commit comments

Comments
 (0)