From 06eb561af535dd72bfe7270f30aaee982b8617e0 Mon Sep 17 00:00:00 2001 From: Anton Gavrilov Date: Fri, 9 Jun 2017 13:24:23 +0300 Subject: [PATCH] Duration limit made optional for EthashParams (#5777) * Duration limit made optional for EthashParams * Forgotten space added --- ethcore/src/ethereum/ethash.rs | 2 +- json/src/spec/ethash.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ethcore/src/ethereum/ethash.rs b/ethcore/src/ethereum/ethash.rs index 6e698150b..1013612e8 100644 --- a/ethcore/src/ethereum/ethash.rs +++ b/ethcore/src/ethereum/ethash.rs @@ -106,7 +106,7 @@ impl From for EthashParams { difficulty_bound_divisor: p.difficulty_bound_divisor.into(), difficulty_increment_divisor: p.difficulty_increment_divisor.map_or(10, Into::into), metropolis_difficulty_increment_divisor: p.metropolis_difficulty_increment_divisor.map_or(9, Into::into), - duration_limit: p.duration_limit.into(), + duration_limit: p.duration_limit.map_or(0, Into::into), block_reward: p.block_reward.into(), registrar: p.registrar.map_or_else(Address::new, Into::into), homestead_transition: p.homestead_transition.map_or(0, Into::into), diff --git a/json/src/spec/ethash.rs b/json/src/spec/ethash.rs index 926dcacee..ff435b72a 100644 --- a/json/src/spec/ethash.rs +++ b/json/src/spec/ethash.rs @@ -39,7 +39,7 @@ pub struct EthashParams { pub metropolis_difficulty_increment_divisor: Option, /// See main EthashParams docs. #[serde(rename="durationLimit")] - pub duration_limit: Uint, + pub duration_limit: Option, /// See main EthashParams docs. #[serde(rename="blockReward")] pub block_reward: Uint, @@ -193,7 +193,7 @@ mod tests { difficulty_bound_divisor: Uint(U256::from(0x0800)), difficulty_increment_divisor: None, metropolis_difficulty_increment_divisor: None, - duration_limit: Uint(U256::from(0x0d)), + duration_limit: Some(Uint(U256::from(0x0d))), block_reward: Uint(U256::from(0x4563918244F40000u64)), registrar: Some(Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))), homestead_transition: Some(Uint(U256::from(0x42))), @@ -248,7 +248,6 @@ mod tests { "gasLimitBoundDivisor": "0x0400", "minimumDifficulty": "0x020000", "difficultyBoundDivisor": "0x0800", - "durationLimit": "0x0d", "blockReward": "0x4563918244F40000" } }"#; @@ -261,7 +260,7 @@ mod tests { difficulty_bound_divisor: Uint(U256::from(0x0800)), difficulty_increment_divisor: None, metropolis_difficulty_increment_divisor: None, - duration_limit: Uint(U256::from(0x0d)), + duration_limit: None, block_reward: Uint(U256::from(0x4563918244F40000u64)), registrar: None, homestead_transition: None,