diff options
author | alpaylan | 2021-04-15 00:24:40 +0300 |
---|---|---|
committer | alpaylan | 2021-04-15 00:24:40 +0300 |
commit | 7bcdcbcaa5bc8b03f8838630761bb99bb2cecef0 (patch) | |
tree | 3906bc12afd1d7858f7ccf0664c3a2a1d20a3755 /src/schema.rs | |
parent | ce03d1402e8076fa3c249f983164bc10acdf3914 (diff) | |
parent | cc1426f6d4e811fdb26a8ba5cff487ba63d0a6b5 (diff) | |
download | gradecoin-7bcdcbcaa5bc8b03f8838630761bb99bb2cecef0.tar.gz gradecoin-7bcdcbcaa5bc8b03f8838630761bb99bb2cecef0.tar.bz2 gradecoin-7bcdcbcaa5bc8b03f8838630761bb99bb2cecef0.zip |
Merge remote-tracking branch 'origin/main'
Diffstat (limited to 'src/schema.rs')
-rw-r--r-- | src/schema.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/schema.rs b/src/schema.rs index c740bf3..af10b4d 100644 --- a/src/schema.rs +++ b/src/schema.rs | |||
@@ -93,15 +93,28 @@ pub struct Claims { | |||
93 | pub struct Db { | 93 | pub struct Db { |
94 | pub blockchain: Arc<RwLock<Block>>, | 94 | pub blockchain: Arc<RwLock<Block>>, |
95 | pub pending_transactions: Arc<RwLock<HashMap<Fingerprint, Transaction>>>, | 95 | pub pending_transactions: Arc<RwLock<HashMap<Fingerprint, Transaction>>>, |
96 | pub users: Arc<RwLock<HashMap<String, User>>>, | 96 | pub users: Arc<RwLock<HashMap<Fingerprint, User>>>, |
97 | } | 97 | } |
98 | 98 | ||
99 | impl Db { | 99 | impl Db { |
100 | fn new() -> Self { | 100 | fn new() -> Self { |
101 | let mut users: HashMap<Fingerprint, User> = HashMap::new(); | ||
102 | |||
103 | let bank_acc = MetuId::new("bank".to_owned(), "P7oxDm30g1jeIId".to_owned()).unwrap(); | ||
104 | |||
105 | users.insert( | ||
106 | "31415926535897932384626433832795028841971693993751058209749445923".to_owned(), | ||
107 | User { | ||
108 | user_id: bank_acc, | ||
109 | public_key: "null".to_owned(), | ||
110 | balance: 27 * 80, | ||
111 | }, | ||
112 | ); | ||
113 | |||
101 | Db { | 114 | Db { |
102 | blockchain: Arc::new(RwLock::new(Block::new())), | 115 | blockchain: Arc::new(RwLock::new(Block::new())), |
103 | pending_transactions: Arc::new(RwLock::new(HashMap::new())), | 116 | pending_transactions: Arc::new(RwLock::new(HashMap::new())), |
104 | users: Arc::new(RwLock::new(HashMap::new())), | 117 | users: Arc::new(RwLock::new(users)), |
105 | } | 118 | } |
106 | } | 119 | } |
107 | } | 120 | } |
@@ -216,6 +229,7 @@ lazy_static! { | |||
216 | ("e223786", "UxI6czykJfp9T9N"), | 229 | ("e223786", "UxI6czykJfp9T9N"), |
217 | ("e231060", "VJgziofQQPCoisH"), | 230 | ("e231060", "VJgziofQQPCoisH"), |
218 | ("e223795", "pmcTCKox99NFsqp"), | 231 | ("e223795", "pmcTCKox99NFsqp"), |
232 | ("bank", "P7oxDm30g1jeIId"), | ||
219 | ] | 233 | ] |
220 | .iter() | 234 | .iter() |
221 | .cloned() | 235 | .cloned() |