Skip to content

Commit

Permalink
refactor setup_many_unchained_txs
Browse files Browse the repository at this point in the history
- Fix the test setup for many unchained txs

[Ticket: X]
  • Loading branch information
tvpeter committed Jan 20, 2025
1 parent aab6df8 commit 8b81584
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions crates/chain/benches/canonicalization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,8 @@ fn setup_many_chained_unconfirmed(
0,
)]
},
outputs: vec![TxOutTemplate::new(Amount::ONE_BTC.to_sat(), Some(1))],
anchors: vec![],
last_seen: Some(i as u64),
..Default::default()
});
}

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

for previous_output_name in previous_outputs.drain(..) {
for (parent_index, previous_output_name) in previous_outputs.drain(..).enumerate() {
for conflict_i in 1..=conflicts_per_output {
let tx_name = format!("depth_{}_conflict_{}", depth, conflict_i);
let tx_name = format!(
"depth_{}_parent_{}_conflict_{}",
depth, parent_index, conflict_i
);

let mut last_seen = depth * conflict_i;
if last_seen % 2 == 0 {
last_seen /= 2;
}
let last_seen = depth as u64 * conflict_i as u64;

templates.push(TxTemplate {
tx_name: tx_name.clone().into(),
Expand All @@ -380,7 +379,7 @@ fn setup_nested_conflicts(
Some(0),
)],
anchors: vec![],
last_seen: Some(last_seen as u64),
last_seen: Some(last_seen),
});

next_outputs.push(tx_name);
Expand Down

0 comments on commit 8b81584

Please sign in to comment.