Client trait reorg

This commit is contained in:
keorn
2016-12-10 18:35:29 +01:00
parent f3af0f46be
commit b6c7ed24b7
4 changed files with 12 additions and 13 deletions

View File

@@ -1294,6 +1294,11 @@ impl BlockChainClient for Client {
}
}
fn broadcast_consensus_message(&self, message: Bytes) {
self.notify(|notify| notify.broadcast(message.clone()));
}
fn signing_network_id(&self) -> Option<u64> {
self.engine.signing_network_id(&self.latest_env_info())
}
@@ -1360,10 +1365,6 @@ impl MiningBlockChainClient for Client {
&self.factories.vm
}
fn broadcast_message(&self, message: Bytes) {
self.notify(|notify| notify.broadcast(message.clone()));
}
fn update_sealing(&self) {
self.miner.update_sealing(self)
}

View File

@@ -363,8 +363,6 @@ impl MiningBlockChainClient for TestBlockChainClient {
fn broadcast_proposal_block(&self, _block: SealedBlock) {}
fn broadcast_message(&self, _message: Bytes) {}
fn update_sealing(&self) {
self.miner.update_sealing(self)
}
@@ -681,6 +679,8 @@ impl BlockChainClient for TestBlockChainClient {
self.spec.engine.handle_message(UntrustedRlp::new(&message)).unwrap();
}
fn broadcast_consensus_message(&self, _message: Bytes) {}
fn pending_transactions(&self) -> Vec<SignedTransaction> {
self.miner.pending_transactions(self.chain_info().best_block_number)
}

View File

@@ -205,6 +205,9 @@ pub trait BlockChainClient : Sync + Send {
/// Queue conensus engine message.
fn queue_consensus_message(&self, message: Bytes);
/// Used by PoA to communicate with peers.
fn broadcast_consensus_message(&self, message: Bytes);
/// list all transactions
fn pending_transactions(&self) -> Vec<SignedTransaction>;
@@ -282,9 +285,6 @@ pub trait MiningBlockChainClient: BlockChainClient {
/// Used by PoA to submit gathered signatures.
fn submit_seal(&self, block_hash: H256, seal: Vec<Bytes>);
/// Used by PoA to communicate with peers.
fn broadcast_message(&self, message: Bytes);
/// Broadcast a block proposal.
fn broadcast_proposal_block(&self, block: SealedBlock);