remove mocknet stuff, clean up debug

This commit is contained in:
keorn
2016-09-27 15:50:16 +01:00
parent 0c69d4a1ce
commit 28cf91c7a5
12 changed files with 13 additions and 451 deletions

View File

@@ -52,7 +52,7 @@ use blockchain::{BlockChain, BlockProvider, TreeRoute, ImportRoute};
use client::{
BlockID, TransactionID, UncleID, TraceId, ClientConfig, BlockChainClient,
MiningBlockChainClient, TraceFilter, CallAnalytics, BlockImportError, Mode,
ChainNotify, TransactionImportResult
ChainNotify
};
use client::Error as ClientError;
use env_info::EnvInfo;
@@ -480,16 +480,6 @@ impl Client {
results.len()
}
// TODO: these are only used for tests in sync and only contribute to huge Client
/// Import a locally created transaction.
pub fn import_own_transaction(&self, transaction: SignedTransaction) -> Result<TransactionImportResult, EthcoreError> {
self.miner.import_own_transaction(self, transaction)
}
/// Set miner author.
pub fn set_author(&self, author: Address) {
self.miner.set_author(author)
}
/// Used by PoA to try sealing on period change.
pub fn update_sealing(&self) {
self.miner.update_sealing(self)
@@ -1039,13 +1029,8 @@ impl BlockChainClient for Client {
} else {
let len = transactions.len();
match self.io_channel.send(ClientIoMessage::NewTransactions(transactions)) {
Ok(_) => {
trace!(target: "external_tx", "Sent IoMessage");
self.queue_transactions.fetch_add(len, AtomicOrdering::SeqCst);
}
Err(e) => {
debug!("Ignoring {} transactions: error queueing: {}", len, e);
}
Ok(_) => { self.queue_transactions.fetch_add(len, AtomicOrdering::SeqCst); },
Err(e) => debug!("Ignoring {} transactions: error queueing: {}", len, e),
}
}
}

View File

@@ -29,7 +29,6 @@ use evm::Schedule;
use ethjson;
use io::{IoContext, IoHandler, TimerToken, IoService, IoChannel};
use service::ClientIoMessage;
use time::get_time;
/// `AuthorityRound` params.
#[derive(Debug, PartialEq)]
@@ -119,7 +118,10 @@ impl IoHandler<BlockArrived> for TransitionHandler {
debug!(target: "authorityround", "Timeout step: {}", engine.step.load(AtomicOrdering::Relaxed));
engine.step.fetch_add(1, AtomicOrdering::SeqCst);
if let Some(ref channel) = *engine.message_channel.try_lock().unwrap() {
channel.send(ClientIoMessage::UpdateSealing);
match channel.send(ClientIoMessage::UpdateSealing) {
Ok(_) => trace!(target: "authorityround", "timeout: UpdateSealing message sent."),
Err(_) => trace!(target: "authorityround", "timeout: Could not send a sealing message."),
}
}
io.register_timer_once(ENGINE_TIMEOUT_TOKEN, engine.our_params.step_duration).expect("Failed to restart consensus step timer.")
}

View File

@@ -132,7 +132,7 @@ pub trait Engine : Sync + Send {
/// Panics if `is_builtin(a)` is not true.
fn execute_builtin(&self, a: &Address, input: &[u8], output: &mut BytesRef) { self.builtins().get(a).unwrap().execute(input, output); }
/// Add a channel for communication with Client.
fn register_message_channel(&self, message_channel: IoChannel<ClientIoMessage>) {}
/// Add a channel for communication with Client which can be used for sealing.
fn register_message_channel(&self, _message_channel: IoChannel<ClientIoMessage>) {}
// TODO: sealing stuff - though might want to leave this for later.
}

View File

@@ -78,7 +78,7 @@ impl Default for MinerOptions {
MinerOptions {
new_work_notify: vec![],
force_sealing: false,
reseal_on_external_tx: true,
reseal_on_external_tx: false,
reseal_on_own_tx: true,
tx_gas_limit: !U256::zero(),
tx_queue_size: 1024,

View File

@@ -21,7 +21,7 @@ use io::*;
use spec::Spec;
use error::*;
use client::{Client, ClientConfig, ChainNotify};
use miner::{Miner, MinerService};
use miner::Miner;
use snapshot::ManifestData;
use snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
use std::sync::atomic::AtomicBool;
@@ -202,7 +202,7 @@ impl IoHandler<ClientIoMessage> for ClientIoHandler {
}
},
ClientIoMessage::UpdateSealing => {
println!("Message received!");
trace!(target: "authorityround", "message: UpdateSealing");
self.client.update_sealing()
},
_ => {} // ignore other messages