]> Untitled Git - bdk/commitdiff
chore(test): rename `txid_to_name` to proper `tx_name_to_txid`
authorLeonardo Lima <oleonardolima@users.noreply.github.com>
Fri, 12 Sep 2025 04:37:31 +0000 (14:37 +1000)
committerLeonardo Lima <oleonardolima@users.noreply.github.com>
Sat, 22 Nov 2025 04:39:23 +0000 (01:39 -0300)
crates/chain/tests/common/tx_template.rs
crates/chain/tests/test_tx_graph_conflicts.rs

index 29f36169ad05a19728d26bb2cc31ef6c5043fea0..52f8e8508459d11dd4dc16afa76c9457c70adb6f 100644 (file)
@@ -56,7 +56,7 @@ impl TxOutTemplate {
 pub struct TxTemplateEnv<'a, A> {
     pub tx_graph: TxGraph<A>,
     pub indexer: SpkTxOutIndex<u32>,
-    pub txid_to_name: HashMap<&'a str, Txid>,
+    pub tx_name_to_txid: HashMap<&'a str, Txid>,
     pub canonicalization_params: CanonicalizationParams,
 }
 
@@ -77,7 +77,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
                 .script_pubkey(),
         );
     });
-    let mut txid_to_name = HashMap::<&'a str, Txid>::new();
+    let mut tx_name_to_txid = HashMap::<&'a str, Txid>::new();
 
     let mut canonicalization_params = CanonicalizationParams::default();
     for (bogus_txin_vout, tx_tmp) in tx_templates.into_iter().enumerate() {
@@ -108,7 +108,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
                         witness: Witness::new(),
                     },
                     TxInTemplate::PrevTx(prev_name, prev_vout) => {
-                        let prev_txid = txid_to_name.get(prev_name).expect(
+                        let prev_txid = tx_name_to_txid.get(prev_name).expect(
                             "txin template must spend from tx of template that comes before",
                         );
                         TxIn {
@@ -140,7 +140,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
         if tx_tmp.assume_canonical {
             canonicalization_params.assume_canonical.push(txid);
         }
-        txid_to_name.insert(tx_tmp.tx_name, txid);
+        tx_name_to_txid.insert(tx_tmp.tx_name, txid);
         indexer.scan(&tx);
         let _ = tx_graph.insert_tx(tx.clone());
         for anchor in tx_tmp.anchors.iter() {
@@ -153,7 +153,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
     TxTemplateEnv {
         tx_graph,
         indexer,
-        txid_to_name,
+        tx_name_to_txid,
         canonicalization_params,
     }
 }
index 71944e404b9fbf7a9f8bc1f1183246f01ee1c04b..113a985b4624cb7fc6463cfa3743deee8d756ecb 100644 (file)
@@ -978,7 +978,7 @@ fn test_tx_conflict_handling() {
         let exp_txs = scenario
             .exp_chain_txs
             .iter()
-            .map(|txid| *env.txid_to_name.get(txid).expect("txid must exist"))
+            .map(|txid| *env.tx_name_to_txid.get(txid).expect("txid must exist"))
             .collect::<BTreeSet<_>>();
         assert_eq!(
             txs, exp_txs,
@@ -1000,7 +1000,7 @@ fn test_tx_conflict_handling() {
             .exp_chain_txouts
             .iter()
             .map(|(txid, vout)| OutPoint {
-                txid: *env.txid_to_name.get(txid).expect("txid must exist"),
+                txid: *env.tx_name_to_txid.get(txid).expect("txid must exist"),
                 vout: *vout,
             })
             .collect::<BTreeSet<_>>();
@@ -1024,7 +1024,7 @@ fn test_tx_conflict_handling() {
             .exp_unspents
             .iter()
             .map(|(txid, vout)| OutPoint {
-                txid: *env.txid_to_name.get(txid).expect("txid must exist"),
+                txid: *env.tx_name_to_txid.get(txid).expect("txid must exist"),
                 vout: *vout,
             })
             .collect::<BTreeSet<_>>();