summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-10-21 09:56:21 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-10-21 09:56:28 +0800
commitf754675aac96ac04599ec79d609e2c5b08be4561 (patch)
treea92a2e4b910593d3593744dd99bae0ba28a44c37 /src/main.rs
parentb71fae628d97ada84c533ce746d4d7980a9f6d73 (diff)
feat: ui
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 0c25725..2abe8d7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,8 +1,12 @@
-use std::{sync::Arc, time::Duration};
+use std::{io, sync::Arc};
use bitcoin::{blocks::BlockChain, network::Network};
use tokio::sync::Mutex;
+use crate::ui::Ui;
+
+pub mod ui;
+
#[tokio::main]
async fn main() {
let bc = Arc::new(Mutex::new(BlockChain::default()));
@@ -16,5 +20,25 @@ async fn main() {
.await
.broadcast(bitcoin::network::Request::Ibd(None))
.await;
- tokio::time::sleep(Duration::from_secs(100)).await;
+ let n = network
+ .lock()
+ .await;
+ let mut binding = network
+ .lock()
+ .await;
+ let mut ui = Ui::new(
+ binding.get_config(),
+ n.get_blockchain()
+ .clone(),
+ n.get_me(),
+ );
+ loop {
+ let mut cmd = String::new();
+ io::stdin()
+ .read_line(&mut cmd)
+ .unwrap();
+
+ ui.cmd(&cmd)
+ .await;
+ }
}