make fields defaulting to 0 optional

This commit is contained in:
keorn
2016-12-22 07:06:40 +01:00
parent b369939f20
commit 552a772cc1
5 changed files with 16 additions and 16 deletions

View File

@@ -59,9 +59,9 @@ impl BlockChain {
mix_hash: self.genesis_block.mix_hash.clone(),
}),
difficulty: self.genesis_block.difficulty,
author: self.genesis_block.author.clone(),
timestamp: self.genesis_block.timestamp,
parent_hash: self.genesis_block.parent_hash.clone(),
author: Some(self.genesis_block.author.clone()),
timestamp: Some(self.genesis_block.timestamp),
parent_hash: Some(self.genesis_block.parent_hash.clone()),
gas_limit: self.genesis_block.gas_limit,
transactions_root: Some(self.genesis_block.transactions_root.clone()),
receipts_root: Some(self.genesis_block.receipts_root.clone()),

View File

@@ -28,13 +28,13 @@ pub struct Genesis {
pub seal: Seal,
/// Difficulty.
pub difficulty: Uint,
/// Block author.
pub author: Address,
/// Block timestamp.
pub timestamp: Uint,
/// Parent hash.
/// Block author, defaults to 0.
pub author: Option<Address>,
/// Block timestamp, defaults to 0.
pub timestamp: Option<Uint>,
/// Parent hash, defaults to 0.
#[serde(rename="parentHash")]
pub parent_hash: H256,
pub parent_hash: Option<H256>,
/// Gas limit.
#[serde(rename="gasLimit")]
pub gas_limit: Uint,

View File

@@ -22,9 +22,9 @@ use hash::H256;
/// Spec params.
#[derive(Debug, PartialEq, Deserialize)]
pub struct Params {
/// Account start nonce.
/// Account start nonce, defaults to 0.
#[serde(rename="accountStartNonce")]
pub account_start_nonce: Uint,
pub account_start_nonce: Option<Uint>,
/// Maximum size of extra data.
#[serde(rename="maximumExtraDataSize")]
pub maximum_extra_data_size: Uint,