]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commitdiff
Drop several unused dependencies
authorMatt Corallo <git@bluematt.me>
Sun, 11 Sep 2022 18:14:32 +0000 (18:14 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 13 Sep 2022 16:17:40 +0000 (16:17 +0000)
Cargo.toml
src/tracking.rs

index 5926971fcb412e9424599728fc5d1c2da6fa99e9..315c66f2c5876b00b19facbc79438de805381473 100644 (file)
@@ -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" }
 
index f76db3989815320c28a96906d15d488a5012e375..83e1887e09a594fc613bb145c744eea506b1d410 100644 (file)
@@ -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<GossipMessage>,
                completion_sender: mpsc::Sender<()>,
                network_graph: Arc<NetworkGraph<TestLogger>>) {
-       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 {