aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/db.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/db.rs b/src/db.rs
index a00def5..85d43a0 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -10,6 +10,7 @@
10//! with their public keys, `metu_ids` and gradecoin balances. 10//! with their public keys, `metu_ids` and gradecoin balances.
11use crate::block::{Block, Fingerprint, Id, Transaction}; 11use crate::block::{Block, Fingerprint, Id, Transaction};
12use crate::student::{MetuId, User, UserAtRest}; 12use crate::student::{MetuId, User, UserAtRest};
13use crate::config::Config;
13use log::debug; 14use log::debug;
14use parking_lot::RwLock; 15use parking_lot::RwLock;
15use std::{collections::HashMap, fs, io, path::PathBuf, sync::Arc}; 16use std::{collections::HashMap, fs, io, path::PathBuf, sync::Arc};
@@ -21,6 +22,7 @@ pub struct Db {
21 pub blockchain: Arc<RwLock<Block>>, 22 pub blockchain: Arc<RwLock<Block>>,
22 pub pending_transactions: Arc<RwLock<HashMap<Id, Transaction>>>, 23 pub pending_transactions: Arc<RwLock<HashMap<Id, Transaction>>>,
23 pub users: Arc<RwLock<HashMap<Fingerprint, User>>>, 24 pub users: Arc<RwLock<HashMap<Fingerprint, User>>>,
25 pub config: Config,
24 preapproved_users: Vec<MetuId>, 26 preapproved_users: Vec<MetuId>,
25} 27}
26 28
@@ -44,6 +46,14 @@ impl Db {
44 blockchain: Arc::new(RwLock::new(Block::default())), 46 blockchain: Arc::new(RwLock::new(Block::default())),
45 pending_transactions: Arc::new(RwLock::new(HashMap::new())), 47 pending_transactions: Arc::new(RwLock::new(HashMap::new())),
46 users: Arc::new(RwLock::new(users)), 48 users: Arc::new(RwLock::new(users)),
49 config: Config {
50 block_transaction_count: 4,
51 register_bonus: 100,
52 block_reward: 4,
53 tx_upper_limit: 4,
54 tx_lower_limit: 1,
55 tx_traffic_reward: 1,
56 },
47 preapproved_users, 57 preapproved_users,
48 } 58 }
49 } 59 }