fixed env_info lasthashes generation

This commit is contained in:
debris 2016-01-14 23:02:59 +01:00
parent 4ca353b021
commit f06d313ddb

View File

@ -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
}
}
}