p2pderivatives / rust-bitcoin-coin-selection

10 stars 5 forks source link

Missed Solution #20

Closed yancyribbens closed 7 months ago

yancyribbens commented 1 year ago

Recently I've found an edge case where a solution should be found but is not. For example, consider the following UTXO set:

{1, 2, 2.5, 4}

And, if we are looking for a target of 7, the solution ought to be: {1, 2, 4}, however, in my testing, no match is found, even though the combination is possible.

Here is the test that should pass but fails:

#[test]
fn find_solution_test() {
    let utxo_pool = vec![
    MinimalUtxo { value: ONE_BTC },
    MinimalUtxo { value: TWO_BTC },
    MinimalUtxo { value: 2 * ONE_BTC + 50000000 },
    MinimalUtxo { value: FOUR_BTC },
];

see branch: https://github.com/p2pderivatives/rust-bitcoin-coin-selection/tree/bug/incorrect-solution

yancyribbens commented 9 months ago

closed by https://github.com/p2pderivatives/rust-bitcoin-coin-selection/pull/28

yancyribbens commented 7 months ago

closed by https://github.com/p2pderivatives/rust-bitcoin-coin-selection/pull/30