Duration limit made optional for EthashParams (#5777)

* Duration limit made optional for EthashParams

* Forgotten space added
This commit is contained in:
Anton Gavrilov 2017-06-09 13:24:23 +03:00 committed by Gav Wood
parent 51ef847c64
commit 06eb561af5
2 changed files with 4 additions and 5 deletions

View File

@ -106,7 +106,7 @@ impl From<ethjson::spec::EthashParams> 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),

View File

@ -39,7 +39,7 @@ pub struct EthashParams {
pub metropolis_difficulty_increment_divisor: Option<Uint>,
/// See main EthashParams docs.
#[serde(rename="durationLimit")]
pub duration_limit: Uint,
pub duration_limit: Option<Uint>,
/// 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,