only use engineclient trait for engines, separated from client trait

This commit is contained in:
Robert Habermeier
2017-08-22 16:00:44 +08:00
parent 2985561012
commit 9ae2ed39ec
13 changed files with 93 additions and 52 deletions

View File

@@ -307,7 +307,7 @@ pub trait MiningBlockChainClient: BlockChainClient {
}
/// Client facilities used by internally sealing Engines.
pub trait EngineClient: MiningBlockChainClient {
pub trait EngineClient: Sync + Send {
/// Make a new block and seal it.
fn update_sealing(&self);
@@ -323,6 +323,17 @@ pub trait EngineClient: MiningBlockChainClient {
///
/// The block corresponding the the parent hash must be stored already.
fn epoch_transition_for(&self, parent_hash: H256) -> Option<::engines::EpochTransition>;
/// Get block chain info.
fn chain_info(&self) -> BlockChainInfo;
/// Like `call`, but with various defaults. Designed to be used for calling contracts.
fn call_contract(&self, id: BlockId, address: Address, data: Bytes) -> Result<Bytes, String>;
/// Import a transaction: used for misbehaviour reporting.
fn transact_contract(&self, address: Address, data: Bytes) -> Result<TransactionImportResult, EthcoreError>;
fn block_number(&self, id: BlockId) -> Option<BlockNumber>;
}
/// Extended client interface for providing proofs of the state.