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,
}
.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() {
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 {
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() {
TxTemplateEnv {
tx_graph,
indexer,
- txid_to_name,
+ tx_name_to_txid,
canonicalization_params,
}
}
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,
.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<_>>();
.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<_>>();