diff options
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 2a9e1db..1002cb8 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() |
