diff options
author | Yigit Sever | 2021-04-17 19:47:39 +0300 |
---|---|---|
committer | Yigit Sever | 2021-04-17 19:47:39 +0300 |
commit | cd4214da789df660c5d1d70f390ff164da244335 (patch) | |
tree | 83065e654f06d876c227dae960ec7d13f329c94b /src/schema.rs | |
parent | 240355e1df485ca869a9b0074c085d25417bf36c (diff) | |
download | gradecoin-cd4214da789df660c5d1d70f390ff164da244335.tar.gz gradecoin-cd4214da789df660c5d1d70f390ff164da244335.tar.bz2 gradecoin-cd4214da789df660c5d1d70f390ff164da244335.zip |
Implement block/tx bounds
Diffstat (limited to 'src/schema.rs')
-rw-r--r-- | src/schema.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/schema.rs b/src/schema.rs index df7b14a..957f0a9 100644 --- a/src/schema.rs +++ b/src/schema.rs | |||
@@ -27,7 +27,7 @@ pub type Fingerprint = String; | |||
27 | fn block_parser(path: String) -> u64 { | 27 | fn block_parser(path: String) -> u64 { |
28 | let end_pos = path.find(".block").unwrap(); | 28 | let end_pos = path.find(".block").unwrap(); |
29 | let block_str = path[9..end_pos].to_string(); | 29 | let block_str = path[9..end_pos].to_string(); |
30 | let block_u64 : u64 = block_str.parse().unwrap(); | 30 | let block_u64: u64 = block_str.parse().unwrap(); |
31 | block_u64 | 31 | block_u64 |
32 | } | 32 | } |
33 | 33 | ||
@@ -51,7 +51,6 @@ fn last_block_content() -> Option<String> { | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | return Some(blocks[last_block_index].to_str().unwrap().parse().unwrap()); | 53 | return Some(blocks[last_block_index].to_str().unwrap().parse().unwrap()); |
54 | |||
55 | } | 54 | } |
56 | 55 | ||
57 | fn read_block_name() -> io::Result<Vec<PathBuf>> { | 56 | fn read_block_name() -> io::Result<Vec<PathBuf>> { |
@@ -180,7 +179,7 @@ pub struct Transaction { | |||
180 | pub by: Fingerprint, | 179 | pub by: Fingerprint, |
181 | pub source: Fingerprint, | 180 | pub source: Fingerprint, |
182 | pub target: Fingerprint, | 181 | pub target: Fingerprint, |
183 | pub amount: i32, | 182 | pub amount: u16, |
184 | pub timestamp: NaiveDateTime, | 183 | pub timestamp: NaiveDateTime, |
185 | } | 184 | } |
186 | 185 | ||
@@ -238,7 +237,7 @@ impl Default for Block { | |||
238 | pub struct User { | 237 | pub struct User { |
239 | pub user_id: MetuId, | 238 | pub user_id: MetuId, |
240 | pub public_key: String, | 239 | pub public_key: String, |
241 | pub balance: i32, | 240 | pub balance: u16, |
242 | } | 241 | } |
243 | 242 | ||
244 | /// The values are hard coded in [`OUR_STUDENTS`] so MetuId::new() can accept/reject values based on that | 243 | /// The values are hard coded in [`OUR_STUDENTS`] so MetuId::new() can accept/reject values based on that |