Skip to content

Commit 022d5a2

Browse files
committed
test(chain) use Anchor generic on init_graph
1 parent 7aca884 commit 022d5a2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/chain/tests/common/tx_template.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rand::distributions::{Alphanumeric, DistString};
22
use std::collections::HashMap;
33

4-
use bdk_chain::{tx_graph::TxGraph, BlockId, SpkTxOutIndex};
4+
use bdk_chain::{tx_graph::TxGraph, Anchor, SpkTxOutIndex};
55
use bitcoin::{
66
locktime::absolute::LockTime, secp256k1::Secp256k1, OutPoint, ScriptBuf, Sequence, Transaction,
77
TxIn, TxOut, Txid, Witness,
@@ -49,11 +49,11 @@ impl TxOutTemplate {
4949
}
5050

5151
#[allow(dead_code)]
52-
pub fn init_graph<'a>(
53-
tx_templates: impl IntoIterator<Item = &'a TxTemplate<'a, BlockId>>,
54-
) -> (TxGraph<BlockId>, SpkTxOutIndex<u32>, HashMap<&'a str, Txid>) {
52+
pub fn init_graph<'a, A: Anchor + Copy + 'a>(
53+
tx_templates: impl IntoIterator<Item = &'a TxTemplate<'a, A>>,
54+
) -> (TxGraph<A>, SpkTxOutIndex<u32>, HashMap<&'a str, Txid>) {
5555
let (descriptor, _) = Descriptor::parse_descriptor(&Secp256k1::signing_only(), "tr(tprv8ZgxMBicQKsPd3krDUsBAmtnRsK3rb8u5yi1zhQgMhF1tR8MW7xfE4rnrbbsrbPR52e7rKapu6ztw1jXveJSCGHEriUGZV7mCe88duLp5pj/86'/1'/0'/0/*)").unwrap();
56-
let mut graph = TxGraph::<BlockId>::default();
56+
let mut graph = TxGraph::<A>::default();
5757
let mut spk_index = SpkTxOutIndex::default();
5858
(0..10).for_each(|index| {
5959
spk_index.insert_spk(

0 commit comments

Comments
 (0)