diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 8586eec30..f7141248a 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -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 { 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) } diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index 6dd59f43d..485de0d20 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -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 { self.miner.pending_transactions(self.chain_info().best_block_number) } diff --git a/ethcore/src/client/traits.rs b/ethcore/src/client/traits.rs index bf7a180b4..f3c3cd65c 100644 --- a/ethcore/src/client/traits.rs +++ b/ethcore/src/client/traits.rs @@ -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; @@ -282,9 +285,6 @@ pub trait MiningBlockChainClient: BlockChainClient { /// Used by PoA to submit gathered signatures. fn submit_seal(&self, block_hash: H256, seal: Vec); - /// Used by PoA to communicate with peers. - fn broadcast_message(&self, message: Bytes); - /// Broadcast a block proposal. fn broadcast_proposal_block(&self, block: SealedBlock); diff --git a/ethcore/src/service.rs b/ethcore/src/service.rs index c2cb1889e..f4b5eae8d 100644 --- a/ethcore/src/service.rs +++ b/ethcore/src/service.rs @@ -21,7 +21,7 @@ use rlp::{UntrustedRlp, View}; use io::*; use spec::Spec; use error::*; -use client::{Client, MiningBlockChainClient, ClientConfig, ChainNotify}; +use client::{Client, BlockChainClient, MiningBlockChainClient, ClientConfig, ChainNotify}; use miner::Miner; use snapshot::ManifestData; use snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams}; @@ -29,8 +29,6 @@ use std::sync::atomic::AtomicBool; #[cfg(feature="ipc")] use nanoipc; -#[cfg(feature="ipc")] -use client::BlockChainClient; /// Message type for external and internal events #[derive(Clone, PartialEq, Eq, Debug)] @@ -227,7 +225,7 @@ impl IoHandler for ClientIoHandler { }, ClientIoMessage::UpdateSealing => self.client.update_sealing(), ClientIoMessage::SubmitSeal(ref hash, ref seal) => self.client.submit_seal(*hash, seal.clone()), - ClientIoMessage::BroadcastMessage(ref message) => self.client.broadcast_message(message.clone()), + ClientIoMessage::BroadcastMessage(ref message) => self.client.broadcast_consensus_message(message.clone()), ClientIoMessage::NewMessage(ref message) => if let Err(e) = self.client.engine().handle_message(UntrustedRlp::new(message)) { trace!(target: "poa", "Invalid message received: {}", e); },