From f06d313ddbe5daa90715e1062337b1401eec0221 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 14 Jan 2016 23:02:59 +0100 Subject: [PATCH] fixed env_info lasthashes generation --- src/env_info.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/env_info.rs b/src/env_info.rs index a8f99d6ec..8fe715d29 100644 --- a/src/env_info.rs +++ b/src/env_info.rs @@ -39,17 +39,15 @@ impl EnvInfo { pub fn from_json(json: &Json) -> EnvInfo { let current_number = u64_from_json(&json["currentNumber"]); - let e = EnvInfo { + EnvInfo { number: current_number, author: address_from_json(&json["currentCoinbase"]), difficulty: u256_from_json(&json["currentDifficulty"]), gas_limit: u256_from_json(&json["currentGasLimit"]), timestamp: u64_from_json(&json["currentTimestamp"]), - last_hashes: (0..current_number).map(|i| format!("{}", current_number - i).as_bytes().sha3()).collect(), + last_hashes: (0..cmp::min(current_number, 256)).map(|i| format!("{}", current_number - 1 - i).as_bytes().sha3()).collect(), gas_used: x!(0), - }; - println!("hashes: {:?}", e.last_hashes); - e + } } }