From 87814a5e33375a4118b75fce01f8a7c53ba39a37 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 21 Oct 2025 09:04:45 +0800 Subject: fix: p2p connection --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 096b533..0c25725 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{sync::Arc, thread::sleep, time::Duration}; +use std::{sync::Arc, time::Duration}; use bitcoin::{blocks::BlockChain, network::Network}; use tokio::sync::Mutex; @@ -7,10 +7,14 @@ use tokio::sync::Mutex; async fn main() { let bc = Arc::new(Mutex::new(BlockChain::default())); let network = Network::new(bc).await; + network + .lock() + .await + .start(); network .lock() .await .broadcast(bitcoin::network::Request::Ibd(None)) .await; - sleep(Duration::from_secs(100)); + tokio::time::sleep(Duration::from_secs(100)).await; } -- cgit v1.2.3