Skip to content

Commit 663fe27

Browse files
committed
dependency: bump rand version
1 parent af5f8d6 commit 663fe27

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ features = ["rand"]
1818

1919
[dependencies]
2020
bitcoin-units = "1.0.0-rc.0"
21-
rand = { version = "0.8.5", optional = true }
21+
rand = { version = "0.9.2", optional = true }
2222

2323
[dev-dependencies]
2424
bitcoin-units = { version = "1.0.0-rc.0", features = ["arbitrary"] }
2525
criterion = "0.6"
2626
bitcoin-coin-selection = {path = ".", features = ["rand"]}
27-
rand = "0.8.5"
27+
rand = "0.9.2"
2828
arbitrary = { version = "1", features = ["derive"] }
2929
arbtest = "0.3.1"
3030
exhaustigen = "0.1.0"

benches/srd_selection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use bitcoin_coin_selection::{single_random_draw, WeightedUtxo};
22
use bitcoin_units::{Amount, FeeRate, Weight};
33
use criterion::{criterion_group, criterion_main, Criterion};
4-
use rand::thread_rng;
4+
use rand::rng;
55

66
pub fn srd_benchmark(c: &mut Criterion) {
77
let fee_rate = FeeRate::from_sat_per_kwu(10);
@@ -16,7 +16,7 @@ pub fn srd_benchmark(c: &mut Criterion) {
1616
c.bench_function("srd", |b| {
1717
b.iter(|| {
1818
let (iteration_count, inputs) =
19-
single_random_draw(target, max_weight, &mut thread_rng(), &utxos).unwrap();
19+
single_random_draw(target, max_weight, &mut rng(), &utxos).unwrap();
2020
assert_eq!(iteration_count, 1_000);
2121
assert_eq!(inputs.len(), 1_000);
2222
})

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::cmp::Ordering;
2323
use bitcoin_units::{Amount, FeeRate, SignedAmount, Weight};
2424
#[cfg(feature = "rand")]
2525
#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
26-
use rand::thread_rng;
26+
use rand::rng;
2727

2828
pub use crate::branch_and_bound::branch_and_bound;
2929
pub use crate::coin_grinder::coin_grinder;
@@ -176,7 +176,7 @@ pub fn select_coins<'a, T: IntoIterator<Item = &'a WeightedUtxo> + std::marker::
176176
let bnb_result = branch_and_bound(target, cost_of_change, max_weight, weighted_utxos);
177177

178178
if bnb_result.is_err() {
179-
single_random_draw(target, max_weight, &mut thread_rng(), weighted_utxos)
179+
single_random_draw(target, max_weight, &mut rng(), weighted_utxos)
180180
} else {
181181
bnb_result
182182
}

src/single_random_draw.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ mod tests {
108108
use arbitrary::Arbitrary;
109109
use arbtest::arbtest;
110110
use bitcoin_units::Amount;
111+
112+
// https://github.com/rust-random/rand/pull/1634
113+
#[allow(deprecated)]
111114
use rand::rngs::mock::StepRng;
112115

113116
use super::*;
@@ -167,6 +170,8 @@ mod tests {
167170
.assert();
168171
}
169172

173+
// https://github.com/rust-random/rand/pull/1634
174+
#[allow(deprecated)]
170175
fn get_rng() -> StepRng {
171176
// [1, 2]
172177
// let mut vec: Vec<u32> = (1..3).collect();

0 commit comments

Comments
 (0)