fixed env_info lasthashes generation
This commit is contained in:
parent
4ca353b021
commit
f06d313ddb
@ -39,17 +39,15 @@ impl EnvInfo {
|
|||||||
|
|
||||||
pub fn from_json(json: &Json) -> EnvInfo {
|
pub fn from_json(json: &Json) -> EnvInfo {
|
||||||
let current_number = u64_from_json(&json["currentNumber"]);
|
let current_number = u64_from_json(&json["currentNumber"]);
|
||||||
let e = EnvInfo {
|
EnvInfo {
|
||||||
number: current_number,
|
number: current_number,
|
||||||
author: address_from_json(&json["currentCoinbase"]),
|
author: address_from_json(&json["currentCoinbase"]),
|
||||||
difficulty: u256_from_json(&json["currentDifficulty"]),
|
difficulty: u256_from_json(&json["currentDifficulty"]),
|
||||||
gas_limit: u256_from_json(&json["currentGasLimit"]),
|
gas_limit: u256_from_json(&json["currentGasLimit"]),
|
||||||
timestamp: u64_from_json(&json["currentTimestamp"]),
|
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),
|
gas_used: x!(0),
|
||||||
};
|
}
|
||||||
println!("hashes: {:?}", e.last_hashes);
|
|
||||||
e
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user