Skip to content

Commit

Permalink
wip (broken): Add multiple coin weight test
Browse files Browse the repository at this point in the history
  • Loading branch information
yancyribbens committed Jan 28, 2025
1 parent 43fcf37 commit 3ff7975
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/coin_grinder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,4 +454,36 @@ mod tests {

assert_coin_select_params(&params, Some(&["1 BTC", "1 BTC"]));
}

#[test]
fn tmp() {
let mut coins = Vec::new();

for i in 0..5 {
// Heavy: 3, 6, 9, 12, 15,
let heavy = 3 + 3 * i;
coins.push(heavy);

// Medium: 2, 5, 8, 11, 14
let medium = 2 + 3 * i;
coins.push(medium);

// Light: 1, 4, 7, 10, 13
let light = 1 + 3 * i;
coins.push(light);
}

let c: Vec<String> = coins.iter().map(|a| format!("{} BTC", a)).collect();
let v4: Vec<&str> = c.iter().map(|s| s as &str).collect();

let params = ParamsStr {
target: "30 BTC",
change_target: "1000000 sats",
max_weight: "400000",
fee_rate: "5",
weighted_utxos: v4
};

assert_coin_select_params(&params, Some(&["14 BTC", "13 BTC", "4 BTC"]));
}
}

0 comments on commit 3ff7975

Please sign in to comment.