diff options
Diffstat (limited to 'src/schema.rs')
| -rw-r--r-- | src/schema.rs | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/src/schema.rs b/src/schema.rs index 909b5cd..98291d7 100644 --- a/src/schema.rs +++ b/src/schema.rs | |||
| @@ -62,17 +62,25 @@ pub struct Block { | |||
| 62 | // somewhere | 62 | // somewhere | 
| 63 | // I want to keep this as a String vector because it makes things easier elsewhere | 63 | // I want to keep this as a String vector because it makes things easier elsewhere | 
| 64 | pub transaction_list: Vec<String>, // hashes of the transactions (or just "source" for now) | 64 | pub transaction_list: Vec<String>, // hashes of the transactions (or just "source" for now) | 
| 65 | pub nonce: String, | 65 | pub nonce: u32, | 
| 66 | pub timestamp: NaiveDateTime, | 66 | pub timestamp: NaiveDateTime, | 
| 67 | pub hash: String, // future proof'd baby | 67 | pub hash: String, // future proof'd baby | 
| 68 | } | 68 | } | 
| 69 | 69 | ||
| 70 | /// For prototyping and letting serde handle everything json | ||
| 71 | #[derive(Serialize, Deserialize, Debug)] | ||
| 72 | pub struct NakedBlock { | ||
| 73 | pub transaction_list: Vec<String>, | ||
| 74 | pub nonce: u32, | ||
| 75 | pub timestamp: NaiveDateTime, | ||
| 76 | } | ||
| 77 | |||
| 70 | impl Block { | 78 | impl Block { | 
| 71 | /// Genesis block | 79 | /// Genesis block | 
| 72 | pub fn new() -> Block { | 80 | pub fn new() -> Block { | 
| 73 | Block { | 81 | Block { | 
| 74 | transaction_list: vec![], | 82 | transaction_list: vec![], | 
| 75 | nonce: String::from(""), | 83 | nonce: 0, | 
| 76 | timestamp: NaiveDate::from_ymd(2021, 04, 11).and_hms(20, 45, 00), | 84 | timestamp: NaiveDate::from_ymd(2021, 04, 11).and_hms(20, 45, 00), | 
| 77 | hash: String::from(""), | 85 | hash: String::from(""), | 
| 78 | } | 86 | } | 
