Skip to content

Commit d314e02

Browse files
Mariusz Reichertphilippem
authored andcommitted
Fix for cargo install fail. rand::random was not re-exported by bitcoin::secp256k1::rand even thought rand feature was enabled in bitcoin crate
1 parent 5098e19 commit d314e02

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

Cargo.lock

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ arraydeque = "0.5.1"
3333
arrayref = "0.3.6"
3434
base64 = "0.22"
3535
bincode = "1.3.1"
36-
bitcoin = { version = "0.32.4", features = ["serde", "rand"] }
36+
bitcoin = { version = "0.32.4", features = ["serde"] }
3737
clap = "2.33.3"
3838
crossbeam-channel = "0.5.0"
3939
dirs = "5.0.1"
@@ -70,6 +70,7 @@ opentelemetry-otlp = { version = "0.13.0", default-features = false, features =
7070
tracing-subscriber = { version = "0.3.17", default-features = false, features = ["env-filter", "fmt"], optional = true }
7171
opentelemetry-semantic-conventions = { version = "0.12.0", optional = true }
7272
tracing = { version = "0.1.40", default-features = false, features = ["attributes"], optional = true }
73+
rand = "0.9.1"
7374

7475
# optional dependencies for electrum-discovery
7576
electrum-client = { version = "0.8", optional = true }

src/bin/electrs.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{env, process, thread};
1010
use std::sync::{Arc, RwLock};
1111
use std::time::Duration;
1212
use bitcoin::hex::DisplayHex;
13-
use bitcoin::secp256k1::rand;
13+
use rand::{rng, RngCore};
1414
use electrs::{
1515
config::Config,
1616
daemon::Daemon,
@@ -161,7 +161,8 @@ fn run_server(config: Arc<Config>, salt_rwlock: Arc<RwLock<String>>) -> Result<(
161161
}
162162

163163
fn generate_salt() -> String {
164-
let random_bytes: [u8; 32] = rand::random();
164+
let mut random_bytes = [0u8; 32];
165+
rng().fill_bytes(&mut random_bytes);
165166
random_bytes.to_lower_hex_string()
166167
}
167168

0 commit comments

Comments
 (0)