Skip to content

Commit 0a24fd0

Browse files
Mariusz Reichertm-reichert
authored andcommitted
Make sure ip anonymization code uess rand through bitcoin::secp256k1::rand
1 parent 5098e19 commit 0a24fd0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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 bitcoin::secp256k1::rand::{thread_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+
thread_rng().fill_bytes(&mut random_bytes);
165166
random_bytes.to_lower_hex_string()
166167
}
167168

0 commit comments

Comments
 (0)