Skip to content

Commit

Permalink
Fuzz test transaction builder with multiple UTXOs (ordinals#1291)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Jan 19, 2023
1 parent 7f321c4 commit e41f84f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fuzz/fuzz_targets/transaction_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use {
struct Input {
output_value: Option<u64>,
fee_rate: f64,
utxos: Vec<u64>,
}

fuzz_target!(|input: Input| {
Expand All @@ -33,6 +34,15 @@ fuzz_target!(|input: Input| {
let mut amounts = BTreeMap::new();
amounts.insert(outpoint, Amount::from_sat(1_000_000));

for (i, value) in input.utxos.into_iter().enumerate() {
amounts.insert(
format!("0000000000000000000000000000000000000000000000000000000000000000:{i}",)
.parse()
.unwrap(),
Amount::from_sat(value),
);
}

let recipient = "bc1pdqrcrxa8vx6gy75mfdfj84puhxffh4fq46h3gkp6jxdd0vjcsdyspfxcv6"
.parse()
.unwrap();
Expand Down

0 comments on commit e41f84f

Please sign in to comment.