diff options
Diffstat (limited to 'src/schema.rs')
-rw-r--r-- | src/schema.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/schema.rs b/src/schema.rs index b07744a..6719722 100644 --- a/src/schema.rs +++ b/src/schema.rs | |||
@@ -92,6 +92,7 @@ pub struct Transaction { | |||
92 | /// | 92 | /// |
93 | #[derive(Serialize, Deserialize, Debug)] | 93 | #[derive(Serialize, Deserialize, Debug)] |
94 | pub struct Block { | 94 | pub struct Block { |
95 | #[serde(skip_serializing_if = "Vec::is_empty")] | ||
95 | pub transaction_list: Vec<PublicKeySignature>, | 96 | pub transaction_list: Vec<PublicKeySignature>, |
96 | pub nonce: u32, | 97 | pub nonce: u32, |
97 | pub timestamp: NaiveDateTime, | 98 | pub timestamp: NaiveDateTime, |
@@ -101,6 +102,7 @@ pub struct Block { | |||
101 | /// For prototyping and letting serde handle everything json | 102 | /// For prototyping and letting serde handle everything json |
102 | #[derive(Serialize, Deserialize, Debug)] | 103 | #[derive(Serialize, Deserialize, Debug)] |
103 | pub struct NakedBlock { | 104 | pub struct NakedBlock { |
105 | #[serde(skip_serializing_if = "Vec::is_empty", default)] | ||
104 | pub transaction_list: Vec<PublicKeySignature>, | 106 | pub transaction_list: Vec<PublicKeySignature>, |
105 | pub nonce: u32, | 107 | pub nonce: u32, |
106 | pub timestamp: NaiveDateTime, | 108 | pub timestamp: NaiveDateTime, |
@@ -110,10 +112,10 @@ impl Block { | |||
110 | /// Genesis block | 112 | /// Genesis block |
111 | pub fn new() -> Block { | 113 | pub fn new() -> Block { |
112 | Block { | 114 | Block { |
113 | transaction_list: vec![], | 115 | transaction_list: vec!["gradecoin_bank".to_owned()], |
114 | nonce: 0, | 116 | nonce: 0, |
115 | timestamp: NaiveDate::from_ymd(2021, 04, 11).and_hms(20, 45, 00), | 117 | timestamp: NaiveDate::from_ymd(2021, 04, 11).and_hms(20, 45, 00), |
116 | hash: String::from(""), | 118 | hash: String::from("not_actually_mined"), |
117 | } | 119 | } |
118 | } | 120 | } |
119 | } | 121 | } |