fetch gas price corpus from network when needed

This commit is contained in:
Robert Habermeier
2017-02-17 17:08:46 +01:00
parent 7a857a24ae
commit 3b023c82b7
7 changed files with 136 additions and 37 deletions

View File

@@ -33,7 +33,7 @@ use io::IoChannel;
use util::{Bytes, H256, Mutex, RwLock};
use self::header_chain::HeaderChain;
use self::header_chain::{AncestryIter, HeaderChain};
pub use self::service::Service;
@@ -62,6 +62,9 @@ pub trait LightChainClient: Send + Sync {
/// Get the best block header.
fn best_block_header(&self) -> encoded::Header;
/// Get an iterator over a block and its ancestry.
fn ancestry_iter<'a>(&'a self, start: BlockId) -> Box<Iterator<Item=encoded::Header> + 'a>;
/// Get the signing network ID.
fn signing_network_id(&self) -> Option<u64>;
@@ -167,6 +170,11 @@ impl Client {
self.chain.best_header()
}
/// Get an iterator over a block and its ancestry.
pub fn ancestry_iter(&self, start: BlockId) -> AncestryIter {
self.chain.ancestry_iter(start)
}
/// Get the signing network id.
pub fn signing_network_id(&self) -> Option<u64> {
self.engine.signing_network_id(&self.latest_env_info())
@@ -269,6 +277,10 @@ impl LightChainClient for Client {
Client::best_block_header(self)
}
fn ancestry_iter<'a>(&'a self, start: BlockId) -> Box<Iterator<Item=encoded::Header> + 'a> {
Box::new(Client::ancestry_iter(self, start))
}
fn signing_network_id(&self) -> Option<u64> {
Client::signing_network_id(self)
}