Skip to content

Commit 2d61e67

Browse files
committed
chore(test): rename txid_to_name to proper tx_name_to_txid
1 parent faf520d commit 2d61e67

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

crates/chain/tests/common/tx_template.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl TxOutTemplate {
5656
pub struct TxTemplateEnv<'a, A> {
5757
pub tx_graph: TxGraph<A>,
5858
pub indexer: SpkTxOutIndex<u32>,
59-
pub txid_to_name: HashMap<&'a str, Txid>,
59+
pub tx_name_to_txid: HashMap<&'a str, Txid>,
6060
pub canonicalization_params: CanonicalizationParams,
6161
}
6262

@@ -77,7 +77,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
7777
.script_pubkey(),
7878
);
7979
});
80-
let mut txid_to_name = HashMap::<&'a str, Txid>::new();
80+
let mut tx_name_to_txid = HashMap::<&'a str, Txid>::new();
8181

8282
let mut canonicalization_params = CanonicalizationParams::default();
8383
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>(
108108
witness: Witness::new(),
109109
},
110110
TxInTemplate::PrevTx(prev_name, prev_vout) => {
111-
let prev_txid = txid_to_name.get(prev_name).expect(
111+
let prev_txid = tx_name_to_txid.get(prev_name).expect(
112112
"txin template must spend from tx of template that comes before",
113113
);
114114
TxIn {
@@ -140,7 +140,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
140140
if tx_tmp.assume_canonical {
141141
canonicalization_params.assume_canonical.push(txid);
142142
}
143-
txid_to_name.insert(tx_tmp.tx_name, txid);
143+
tx_name_to_txid.insert(tx_tmp.tx_name, txid);
144144
indexer.scan(&tx);
145145
let _ = tx_graph.insert_tx(tx.clone());
146146
for anchor in tx_tmp.anchors.iter() {
@@ -153,7 +153,7 @@ pub fn init_graph<'a, A: Anchor + Clone + 'a>(
153153
TxTemplateEnv {
154154
tx_graph,
155155
indexer,
156-
txid_to_name,
156+
tx_name_to_txid,
157157
canonicalization_params,
158158
}
159159
}

crates/chain/tests/test_tx_graph_conflicts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ fn test_tx_conflict_handling() {
978978
let exp_txs = scenario
979979
.exp_chain_txs
980980
.iter()
981-
.map(|txid| *env.txid_to_name.get(txid).expect("txid must exist"))
981+
.map(|txid| *env.tx_name_to_txid.get(txid).expect("txid must exist"))
982982
.collect::<BTreeSet<_>>();
983983
assert_eq!(
984984
txs, exp_txs,
@@ -1000,7 +1000,7 @@ fn test_tx_conflict_handling() {
10001000
.exp_chain_txouts
10011001
.iter()
10021002
.map(|(txid, vout)| OutPoint {
1003-
txid: *env.txid_to_name.get(txid).expect("txid must exist"),
1003+
txid: *env.tx_name_to_txid.get(txid).expect("txid must exist"),
10041004
vout: *vout,
10051005
})
10061006
.collect::<BTreeSet<_>>();
@@ -1024,7 +1024,7 @@ fn test_tx_conflict_handling() {
10241024
.exp_unspents
10251025
.iter()
10261026
.map(|(txid, vout)| OutPoint {
1027-
txid: *env.txid_to_name.get(txid).expect("txid must exist"),
1027+
txid: *env.tx_name_to_txid.get(txid).expect("txid must exist"),
10281028
vout: *vout,
10291029
})
10301030
.collect::<BTreeSet<_>>();

0 commit comments

Comments
 (0)