From 65f07e5aa73b9c5635dc7c14771e003231f60cba Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 16 Dec 2016 14:54:26 +0100 Subject: [PATCH] Renamed some functions --- ethcore/light/src/client.rs | 2 +- ethcore/light/src/net/tests/mod.rs | 4 ++-- ethcore/light/src/provider.rs | 6 +++--- ethcore/src/client/client.rs | 4 ++-- ethcore/src/client/test_client.rs | 4 ++-- ethcore/src/client/traits.rs | 4 ++-- ethcore/src/miner/miner.rs | 16 ++++++++-------- ethcore/src/miner/mod.rs | 8 ++++---- ethcore/src/tests/client.rs | 10 +++++----- rpc/src/v1/impls/parity.rs | 2 +- rpc/src/v1/tests/helpers/miner_service.rs | 4 ++-- sync/src/chain.rs | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ethcore/light/src/client.rs b/ethcore/light/src/client.rs index 80100f17c..edadc440c 100644 --- a/ethcore/light/src/client.rs +++ b/ethcore/light/src/client.rs @@ -114,7 +114,7 @@ impl Provider for Client { Vec::new() } - fn pending_transactions(&self) -> Vec { + fn ready_transactions(&self) -> Vec { Vec::new() } } diff --git a/ethcore/light/src/net/tests/mod.rs b/ethcore/light/src/net/tests/mod.rs index f9551fc9a..64d53d9c8 100644 --- a/ethcore/light/src/net/tests/mod.rs +++ b/ethcore/light/src/net/tests/mod.rs @@ -169,8 +169,8 @@ impl Provider for TestProvider { req.requests.into_iter().map(|_| ::rlp::EMPTY_LIST_RLP.to_vec()).collect() } - fn pending_transactions(&self) -> Vec { - self.0.client.pending_transactions() + fn ready_transactions(&self) -> Vec { + self.0.client.ready_transactions() } } diff --git a/ethcore/light/src/provider.rs b/ethcore/light/src/provider.rs index ce80929c2..1f9bbf8aa 100644 --- a/ethcore/light/src/provider.rs +++ b/ethcore/light/src/provider.rs @@ -79,7 +79,7 @@ pub trait Provider: Send + Sync { fn header_proofs(&self, req: request::HeaderProofs) -> Vec; /// Provide pending transactions. - fn pending_transactions(&self) -> Vec; + fn ready_transactions(&self) -> Vec; } // Implementation of a light client data provider for a client. @@ -178,7 +178,7 @@ impl Provider for T { req.requests.into_iter().map(|_| ::rlp::EMPTY_LIST_RLP.to_vec()).collect() } - fn pending_transactions(&self) -> Vec { - BlockChainClient::pending_transactions(self) + fn ready_transactions(&self) -> Vec { + BlockChainClient::ready_transactions(self) } } diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 4e54f22b1..25f000c89 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -1334,8 +1334,8 @@ impl BlockChainClient for Client { } } - fn pending_transactions(&self) -> Vec { - self.miner.pending_transactions(self.chain.read().best_block_number()) + fn ready_transactions(&self) -> Vec { + self.miner.ready_transactions(self.chain.read().best_block_number()) } fn queue_consensus_message(&self, message: Bytes) { diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index a3344dab7..a384f1227 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -688,8 +688,8 @@ impl BlockChainClient for TestBlockChainClient { fn broadcast_consensus_message(&self, _message: Bytes) {} - fn pending_transactions(&self) -> Vec { - self.miner.pending_transactions(self.chain_info().best_block_number) + fn ready_transactions(&self) -> Vec { + self.miner.ready_transactions(self.chain_info().best_block_number) } fn signing_network_id(&self) -> Option { None } diff --git a/ethcore/src/client/traits.rs b/ethcore/src/client/traits.rs index 4c3b2a37e..caba647d1 100644 --- a/ethcore/src/client/traits.rs +++ b/ethcore/src/client/traits.rs @@ -211,8 +211,8 @@ pub trait BlockChainClient : Sync + Send { /// Used by PoA to communicate with peers. fn broadcast_consensus_message(&self, message: Bytes); - /// list all transactions - fn pending_transactions(&self) -> Vec; + /// List all transactions that are allowed into the next block. + fn ready_transactions(&self) -> Vec; /// Sorted list of transaction gas prices from at least last sample_size blocks. fn gas_price_corpus(&self, sample_size: usize) -> Vec { diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 3002a1ffc..c7bff4784 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -909,7 +909,7 @@ impl MinerService for Miner { imported } - fn all_transactions(&self) -> Vec { + fn pending_transactions(&self) -> Vec { let queue = self.transaction_queue.lock(); queue.pending_transactions(BlockNumber::max_value()) } @@ -926,7 +926,7 @@ impl MinerService for Miner { self.transaction_queue.lock().future_transactions() } - fn pending_transactions(&self, best_block: BlockNumber) -> Vec { + fn ready_transactions(&self, best_block: BlockNumber) -> Vec { let queue = self.transaction_queue.lock(); match self.options.pending_set { PendingSet::AlwaysQueue => queue.pending_transactions(best_block), @@ -1253,8 +1253,8 @@ mod tests { // then assert_eq!(res.unwrap(), TransactionImportResult::Current); - assert_eq!(miner.all_transactions().len(), 1); - assert_eq!(miner.pending_transactions(best_block).len(), 1); + assert_eq!(miner.pending_transactions().len(), 1); + assert_eq!(miner.ready_transactions(best_block).len(), 1); assert_eq!(miner.pending_transactions_hashes(best_block).len(), 1); assert_eq!(miner.pending_receipts(best_block).len(), 1); // This method will let us know if pending block was created (before calling that method) @@ -1273,8 +1273,8 @@ mod tests { // then assert_eq!(res.unwrap(), TransactionImportResult::Current); - assert_eq!(miner.all_transactions().len(), 1); - assert_eq!(miner.pending_transactions(best_block).len(), 0); + assert_eq!(miner.pending_transactions().len(), 1); + assert_eq!(miner.ready_transactions(best_block).len(), 0); assert_eq!(miner.pending_transactions_hashes(best_block).len(), 0); assert_eq!(miner.pending_receipts(best_block).len(), 0); } @@ -1291,9 +1291,9 @@ mod tests { // then assert_eq!(res.unwrap(), TransactionImportResult::Current); - assert_eq!(miner.all_transactions().len(), 1); + assert_eq!(miner.pending_transactions().len(), 1); assert_eq!(miner.pending_transactions_hashes(best_block).len(), 0); - assert_eq!(miner.pending_transactions(best_block).len(), 0); + assert_eq!(miner.ready_transactions(best_block).len(), 0); assert_eq!(miner.pending_receipts(best_block).len(), 0); // This method will let us know if pending block was created (before calling that method) assert!(miner.prepare_work_sealing(&client)); diff --git a/ethcore/src/miner/mod.rs b/ethcore/src/miner/mod.rs index fa8e7df0a..563e068a6 100644 --- a/ethcore/src/miner/mod.rs +++ b/ethcore/src/miner/mod.rs @@ -144,11 +144,11 @@ pub trait MinerService : Send + Sync { /// Query pending transactions for hash. fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option; - /// Get a list of all ready transactions in the queue. - fn all_transactions(&self) -> Vec; + /// Get a list of all pending transactions in the queue. + fn pending_transactions(&self) -> Vec; - /// Get a list of all pending transactions. - fn pending_transactions(&self, best_block: BlockNumber) -> Vec; + /// Get a list of all transactions that can go into the given block. + fn ready_transactions(&self, best_block: BlockNumber) -> Vec; /// Get a list of all future transactions. fn future_transactions(&self) -> Vec; diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 2e9087133..b56feef05 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -313,11 +313,11 @@ fn does_not_propagate_delayed_transactions() { client.miner().import_own_transaction(&**client, tx0).unwrap(); client.miner().import_own_transaction(&**client, tx1).unwrap(); - assert_eq!(0, client.pending_transactions().len()); - assert_eq!(2, client.miner().all_transactions().len()); - push_blocks_to_client(client, 53, 2, 1); + assert_eq!(0, client.ready_transactions().len()); + assert_eq!(2, client.miner().pending_transactions().len()); + push_blocks_to_client(client, 53, 2, 2); client.import_verified_blocks(); - assert_eq!(2, client.pending_transactions().len()); - assert_eq!(2, client.miner().all_transactions().len()); + assert_eq!(2, client.ready_transactions().len()); + assert_eq!(2, client.miner().pending_transactions().len()); } diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index 0cfc1ba4d..326dc9c2b 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -270,7 +270,7 @@ impl Parity for ParityClient where fn pending_transactions(&self) -> Result, Error> { try!(self.active()); - Ok(take_weak!(self.miner).all_transactions().into_iter().map(Into::into).collect::>()) + Ok(take_weak!(self.miner).pending_transactions().into_iter().map(Into::into).collect::>()) } fn future_transactions(&self) -> Result, Error> { diff --git a/rpc/src/v1/tests/helpers/miner_service.rs b/rpc/src/v1/tests/helpers/miner_service.rs index 0ef0ee0a9..b25bcc39c 100644 --- a/rpc/src/v1/tests/helpers/miner_service.rs +++ b/rpc/src/v1/tests/helpers/miner_service.rs @@ -204,7 +204,7 @@ impl MinerService for TestMinerService { self.pending_transactions.lock().get(hash).cloned() } - fn all_transactions(&self) -> Vec { + fn pending_transactions(&self) -> Vec { self.pending_transactions.lock().values().cloned().map(Into::into).collect() } @@ -212,7 +212,7 @@ impl MinerService for TestMinerService { self.local_transactions.lock().iter().map(|(hash, stats)| (*hash, stats.clone())).collect() } - fn pending_transactions(&self, _best_block: BlockNumber) -> Vec { + fn ready_transactions(&self, _best_block: BlockNumber) -> Vec { self.pending_transactions.lock().values().cloned().map(Into::into).collect() } diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 375cf6595..968107ba5 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -1919,7 +1919,7 @@ impl ChainSync { return 0; } - let transactions = io.chain().pending_transactions(); + let transactions = io.chain().ready_transactions(); if transactions.is_empty() { return 0; }