diff --git a/Cargo.toml b/Cargo.toml index 8210390..3adb0a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ keywords = ["bitcoin", "coin-selection", "coin", "coinselection", "utxo"] readme = "README.md" [dependencies] -bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610"} +bitcoin = "0.32.3" rand = {version = "0.8.5", default-features = false, optional = true} [dev-dependencies] @@ -25,12 +25,3 @@ rand = "0.8.5" [[bench]] name = "coin_selection" harness = false - -[patch.crates-io] -bitcoin_hashes = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } -base58ck = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } -bitcoin-internals = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } -bitcoin-io = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } -bitcoin-primitives = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } -bitcoin-addresses = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } -bitcoin-units = { git = "https://github.com/rust-bitcoin/rust-bitcoin.git", rev = "894f82e7cc9eb459a297d43e82734621e0824610" } diff --git a/src/branch_and_bound.rs b/src/branch_and_bound.rs index e8d1c24..c1f1b8e 100644 --- a/src/branch_and_bound.rs +++ b/src/branch_and_bound.rs @@ -386,6 +386,17 @@ mod tests { assert_eq!(input_str_list, expected_str_list); } + // This is a temporary patch and can be removed when a new relesae of rust-bitcoin is + // published. See: https://github.com/rust-bitcoin/rust-bitcoin/pull/3346 + fn amount_from_str_patch(amount: &str) -> Amount { + let a = Amount::from_str(amount); + + match a { + Ok(a) => a, + Err(_) => Amount::ZERO + } + } + fn assert_coin_select_params(p: &ParamsStr, expected_inputs: &[&str]) { let fee_rate = p.fee_rate.parse::().unwrap(); // would be nice if FeeRate had // from_str like Amount::from_str() @@ -394,7 +405,7 @@ mod tests { let expected_str_list: Vec<_> = expected_inputs.iter().map(|s| Amount::from_str(s).unwrap().to_string()).collect(); let target = Amount::from_str(p.target).unwrap(); - let cost_of_change = Amount::from_str(p.cost_of_change).unwrap(); + let cost_of_change = amount_from_str_patch(p.cost_of_change); let fee_rate = FeeRate::from_sat_per_kwu(fee_rate); let lt_fee_rate = FeeRate::from_sat_per_kwu(lt_fee_rate);