proved execution future

This commit is contained in:
Robert Habermeier
2017-02-26 15:05:33 +01:00
parent 1ff0abc661
commit af235e564e
4 changed files with 166 additions and 71 deletions

View File

@@ -230,22 +230,32 @@ impl Client {
}
/// Get a handle to the verification engine.
pub fn engine(&self) -> &Engine {
&*self.engine
pub fn engine(&self) -> &Arc<Engine> {
&self.engine
}
fn latest_env_info(&self) -> EnvInfo {
let header = self.best_block_header();
/// Get the latest environment info.
pub fn latest_env_info(&self) -> EnvInfo {
self.env_info(BlockId::Latest)
.expect("Best block header and recent hashes always stored; qed")
}
EnvInfo {
/// Get environment info for a given block.
pub fn env_info(&self, id: BlockId) -> Option<EnvInfo> {
let header = match self.block_header(id) {
Some(hdr) => hdr,
None => return None,
};
Some(EnvInfo {
number: header.number(),
author: header.author(),
timestamp: header.timestamp(),
difficulty: header.difficulty(),
last_hashes: self.build_last_hashes(header.hash()),
last_hashes: self.build_last_hashes(header.parent_hash()),
gas_used: Default::default(),
gas_limit: header.gas_limit(),
}
})
}
fn build_last_hashes(&self, mut parent_hash: H256) -> Arc<Vec<H256>> {