diff options
| author | Yigit Sever | 2021-04-17 19:47:39 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-17 19:47:39 +0300 |
| commit | 9ead8e1ffa7bc8619aa7a1fd5802538ed927581e (patch) | |
| tree | 1bc066c9a9e82dd1d6b43b6e01f286516f53c527 /src/schema.rs | |
| parent | 1ec0207d85648c3d7bce9b71b7a22ec081b3f137 (diff) | |
| download | gradecoin-9ead8e1ffa7bc8619aa7a1fd5802538ed927581e.tar.gz gradecoin-9ead8e1ffa7bc8619aa7a1fd5802538ed927581e.tar.bz2 gradecoin-9ead8e1ffa7bc8619aa7a1fd5802538ed927581e.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 |
