From 4364de59a2d73798410b3779b7e973a54e45f288 Mon Sep 17 00:00:00 2001 From: necrashter Date: Sat, 23 Apr 2022 13:56:31 +0300 Subject: Read from config file at start-up --- src/db.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/db.rs') diff --git a/src/db.rs b/src/db.rs index 85d43a0..98aa984 100644 --- a/src/db.rs +++ b/src/db.rs @@ -27,7 +27,7 @@ pub struct Db { } impl Db { - pub fn new() -> Self { + pub fn new(config: Config) -> Self { fs::create_dir_all("blocks").unwrap(); fs::create_dir_all("users").unwrap(); let mut db = Db::default(); @@ -46,14 +46,7 @@ impl Db { blockchain: Arc::new(RwLock::new(Block::default())), pending_transactions: Arc::new(RwLock::new(HashMap::new())), users: Arc::new(RwLock::new(users)), - config: Config { - block_transaction_count: 4, - register_bonus: 100, - block_reward: 4, - tx_upper_limit: 4, - tx_lower_limit: 1, - tx_traffic_reward: 1, - }, + config, preapproved_users, } } -- cgit v1.2.3-70-g09d2