From 8fc03e2dc2da2f4f7f101b70c1f1562a61f7c36a Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 30 Jun 2016 01:09:35 +0300 Subject: [PATCH] deriving ipc service compiling --- ethcore/src/client/client.rs.in | 10 +++++++--- ethcore/src/client/mod.rs | 4 ++-- ethcore/src/client/test_client.rs | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ethcore/src/client/client.rs.in b/ethcore/src/client/client.rs.in index ab6b8ec17..d47b0a266 100644 --- a/ethcore/src/client/client.rs.in +++ b/ethcore/src/client/client.rs.in @@ -505,7 +505,7 @@ impl Client { } } -//#[derive(Ipc)] +#[derive(Ipc)] impl BlockChainClient for Client { fn call(&self, t: &SignedTransaction, analytics: CallAnalytics) -> Result { let header = self.block_header(BlockID::Latest).unwrap(); @@ -690,8 +690,9 @@ impl BlockChainClient for Client { self.block_queue.queue_info() } - fn clear_queue(&self) { + fn clear_queue(&self) -> bool { self.block_queue.clear(); + true } fn chain_info(&self) -> BlockChainInfo { @@ -808,17 +809,20 @@ impl BlockChainClient for Client { .collect::>>() } - fn queue_transactions(&self, transactions: Vec) { + fn queue_transactions(&self, transactions: Vec) -> bool { if self.queue_transactions.load(AtomicOrdering::Relaxed) > MAX_TX_QUEUE_SIZE { debug!("Ignoring {} transactions: queue is full", transactions.len()); + false } else { let len = transactions.len(); match self.io_channel.send(NetworkIoMessage::User(SyncMessage::NewTransactions(transactions))) { Ok(_) => { self.queue_transactions.fetch_add(len, AtomicOrdering::SeqCst); + true } Err(e) => { debug!("Ignoring {} transactions: error queueing: {}", len, e); + false } } } diff --git a/ethcore/src/client/mod.rs b/ethcore/src/client/mod.rs index e3be447a3..66c747e07 100644 --- a/ethcore/src/client/mod.rs +++ b/ethcore/src/client/mod.rs @@ -142,7 +142,7 @@ pub trait BlockChainClient : Sync + Send { fn queue_info(&self) -> BlockQueueInfo; /// Clear block queue and abort all import activity. - fn clear_queue(&self); + fn clear_queue(&self) -> bool; /// Get blockchain information. fn chain_info(&self) -> BlockChainInfo; @@ -182,7 +182,7 @@ pub trait BlockChainClient : Sync + Send { fn import_transactions(&self, transactions: Vec) -> Vec>; /// Queue transactions for importing. - fn queue_transactions(&self, transactions: Vec); + fn queue_transactions(&self, transactions: Vec) -> bool; /// list all transactions fn pending_transactions(&self) -> Vec; diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index a862501ba..defbf701f 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -455,7 +455,8 @@ impl BlockChainClient for TestBlockChainClient { } } - fn clear_queue(&self) { + fn clear_queue(&self) -> bool { + true } fn chain_info(&self) -> BlockChainInfo { @@ -498,10 +499,11 @@ impl BlockChainClient for TestBlockChainClient { .collect::>>() } - fn queue_transactions(&self, transactions: Vec) { + fn queue_transactions(&self, transactions: Vec) -> bool { // import right here let tx = transactions.into_iter().filter_map(|bytes| UntrustedRlp::new(&bytes).as_val().ok()).collect(); self.import_transactions(tx); + true } fn pending_transactions(&self) -> Vec {