diff --git a/Cargo.lock b/Cargo.lock index 695a530e0..ad6152360 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -919,6 +919,7 @@ dependencies = [ "opentelemetry-semantic-conventions", "page_size", "prometheus", + "rand 0.9.1", "rayon", "rocksdb", "rust-crypto", @@ -2363,10 +2364,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", + "rand_chacha 0.3.1", "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -2377,6 +2388,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -2401,6 +2422,15 @@ dependencies = [ "getrandom 0.2.15", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.1", +] + [[package]] name = "rayon" version = "1.10.0" diff --git a/Cargo.toml b/Cargo.toml index 7ec330366..6bf669a83 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ arraydeque = "0.5.1" arrayref = "0.3.6" base64 = "0.22" bincode = "1.3.1" -bitcoin = { version = "0.32.4", features = ["serde", "rand"] } +bitcoin = { version = "0.32.4", features = ["serde"] } clap = "2.33.3" crossbeam-channel = "0.5.0" dirs = "5.0.1" @@ -70,6 +70,7 @@ opentelemetry-otlp = { version = "0.13.0", default-features = false, features = tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"], optional = true } opentelemetry-semantic-conventions = { version = "0.12.0", optional = true } tracing = { version = "0.1.40", default-features = false, features = ["attributes"], optional = true } +rand = "0.9.1" # optional dependencies for electrum-discovery electrum-client = { version = "0.8", optional = true } diff --git a/src/bin/electrs.rs b/src/bin/electrs.rs index 247ddc6c3..134c17ab8 100644 --- a/src/bin/electrs.rs +++ b/src/bin/electrs.rs @@ -10,7 +10,7 @@ use std::{env, process, thread}; use std::sync::{Arc, RwLock}; use std::time::Duration; use bitcoin::hex::DisplayHex; -use bitcoin::secp256k1::rand; +use rand::{rng, RngCore}; use electrs::{ config::Config, daemon::Daemon, @@ -161,7 +161,8 @@ fn run_server(config: Arc, salt_rwlock: Arc>) -> Result<( } fn generate_salt() -> String { - let random_bytes: [u8; 32] = rand::random(); + let mut random_bytes = [0u8; 32]; + rng().fill_bytes(&mut random_bytes); random_bytes.to_lower_hex_string() }