From be1e6eebc81ada44decb22742790166090699473 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 11 Sep 2022 18:14:32 +0000 Subject: [PATCH] Drop several unused dependencies --- Cargo.toml | 6 ------ src/tracking.rs | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5926971..315c66f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,16 +4,10 @@ version = "0.1.0" edition = "2018" [dependencies] -base64 = "0.13.0" -bech32 = "0.8" bitcoin = "0.28.1" -bitcoin-bech32 = "0.12" lightning = { version = "0.0.110" } lightning-block-sync = { version = "0.0.110", features=["rest-client"] } lightning-net-tokio = { version = "0.0.110" } -chrono = "0.4" -hex = "0.3" -rand = "0.4" tokio = { version = "1.14.1", features = ["full"] } tokio-postgres = { version="0.7.5" } diff --git a/src/tracking.rs b/src/tracking.rs index f76db39..83e1887 100644 --- a/src/tracking.rs +++ b/src/tracking.rs @@ -1,3 +1,5 @@ +use std::collections::hash_map::RandomState; +use std::hash::{BuildHasher, Hasher}; use std::net::SocketAddr; use std::sync::Arc; use std::time::{Duration, Instant}; @@ -9,7 +11,6 @@ use lightning::ln::peer_handler::{ ErroringMessageHandler, IgnoringMessageHandler, MessageHandler, PeerManager, }; use lightning::routing::gossip::NetworkGraph; -use rand::{Rng, thread_rng}; use tokio::sync::mpsc; use crate::{config, TestLogger}; @@ -19,12 +20,17 @@ use crate::types::{GossipMessage, GossipPeerManager}; pub(crate) async fn download_gossip(persistence_sender: mpsc::Sender, completion_sender: mpsc::Sender<()>, network_graph: Arc>) { - let mut key = [0; 32]; - let mut random_data = [0; 32]; - thread_rng().fill_bytes(&mut key); - thread_rng().fill_bytes(&mut random_data); - let our_node_secret = SecretKey::from_slice(&key).unwrap(); + let mut key = [42; 32]; + let mut random_data = [43; 32]; + // Get something psuedo-random from std. + let mut key_hasher = RandomState::new().build_hasher(); + key_hasher.write_u8(1); + key[0..8].copy_from_slice(&key_hasher.finish().to_ne_bytes()); + let mut rand_hasher = RandomState::new().build_hasher(); + rand_hasher.write_u8(2); + random_data[0..8].copy_from_slice(&rand_hasher.finish().to_ne_bytes()); + let our_node_secret = SecretKey::from_slice(&key).unwrap(); let router = Arc::new(GossipRouter::new(network_graph, persistence_sender.clone())); let message_handler = MessageHandler { -- 2.39.5