Skip to content

Commit 8b81584

Browse files
committed
refactor setup_many_unchained_txs
- Fix the test setup for many unchained txs [Ticket: X]
1 parent aab6df8 commit 8b81584

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

crates/chain/benches/canonicalization.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,8 @@ fn setup_many_chained_unconfirmed(
332332
0,
333333
)]
334334
},
335-
outputs: vec![TxOutTemplate::new(Amount::ONE_BTC.to_sat(), Some(1))],
336-
anchors: vec![],
337335
last_seen: Some(i as u64),
336+
..Default::default()
338337
});
339338
}
340339

@@ -363,14 +362,14 @@ fn setup_nested_conflicts(
363362
for depth in 1..=graph_depth {
364363
let mut next_outputs = Vec::new();
365364

366-
for previous_output_name in previous_outputs.drain(..) {
365+
for (parent_index, previous_output_name) in previous_outputs.drain(..).enumerate() {
367366
for conflict_i in 1..=conflicts_per_output {
368-
let tx_name = format!("depth_{}_conflict_{}", depth, conflict_i);
367+
let tx_name = format!(
368+
"depth_{}_parent_{}_conflict_{}",
369+
depth, parent_index, conflict_i
370+
);
369371

370-
let mut last_seen = depth * conflict_i;
371-
if last_seen % 2 == 0 {
372-
last_seen /= 2;
373-
}
372+
let last_seen = depth as u64 * conflict_i as u64;
374373

375374
templates.push(TxTemplate {
376375
tx_name: tx_name.clone().into(),
@@ -380,7 +379,7 @@ fn setup_nested_conflicts(
380379
Some(0),
381380
)],
382381
anchors: vec![],
383-
last_seen: Some(last_seen as u64),
382+
last_seen: Some(last_seen),
384383
});
385384

386385
next_outputs.push(tx_name);

0 commit comments

Comments
 (0)