From 797b0c5a686df7483540f4cb6baaeed6d5147ee8 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Wed, 14 Apr 2021 23:27:41 +0300 Subject: Implement the bank account --- src/schema.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/schema.rs') diff --git a/src/schema.rs b/src/schema.rs index 2a9e1db..1002cb8 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -93,15 +93,28 @@ pub struct Claims { pub struct Db { pub blockchain: Arc>, pub pending_transactions: Arc>>, - pub users: Arc>>, + pub users: Arc>>, } impl Db { fn new() -> Self { + let mut users: HashMap = HashMap::new(); + + let bank_acc = MetuId::new("bank".to_owned(), "P7oxDm30g1jeIId".to_owned()).unwrap(); + + users.insert( + "31415926535897932384626433832795028841971693993751058209749445923".to_owned(), + User { + user_id: bank_acc, + public_key: "null".to_owned(), + balance: 27 * 80, + }, + ); + Db { blockchain: Arc::new(RwLock::new(Block::new())), pending_transactions: Arc::new(RwLock::new(HashMap::new())), - users: Arc::new(RwLock::new(HashMap::new())), + users: Arc::new(RwLock::new(users)), } } } @@ -216,6 +229,7 @@ lazy_static! { ("e223786", "UxI6czykJfp9T9N"), ("e231060", "VJgziofQQPCoisH"), ("e223795", "pmcTCKox99NFsqp"), + ("bank", "P7oxDm30g1jeIId"), ] .iter() .cloned() -- cgit v1.2.3-70-g09d2