Merge branch 'auth-bft' of https://github.com/ethcore/parity into auth-bft

This commit is contained in:
keorn
2016-12-11 18:23:54 +01:00
11 changed files with 235 additions and 172 deletions

View File

@@ -580,6 +580,12 @@ impl Client {
self.miner.clone()
}
/// Replace io channel. Useful for testing.
pub fn set_io_channel(&self, io_channel: IoChannel<ClientIoMessage>) {
*self.io_channel.lock() = io_channel;
}
/// Attempt to get a copy of a specific block's final state.
///
/// This will not fail if given BlockId::Latest.
@@ -1289,7 +1295,8 @@ impl BlockChainClient for Client {
}
fn queue_consensus_message(&self, message: Bytes) {
if let Err(e) = self.io_channel.lock().send(ClientIoMessage::NewMessage(message)) {
let channel = self.io_channel.lock().clone();
if let Err(e) = channel.send(ClientIoMessage::NewMessage(message)) {
debug!("Ignoring the message, error queueing: {}", e);
}
}

View File

@@ -676,7 +676,7 @@ impl BlockChainClient for TestBlockChainClient {
}
fn queue_consensus_message(&self, message: Bytes) {
self.spec.engine.handle_message(UntrustedRlp::new(&message)).unwrap();
self.spec.engine.handle_message(&message).unwrap();
}
fn broadcast_consensus_message(&self, _message: Bytes) {}