Renamed some functions

This commit is contained in:
arkpar 2016-12-16 14:54:26 +01:00
parent 6c9de9e6f8
commit 65f07e5aa7
12 changed files with 33 additions and 33 deletions

View File

@ -114,7 +114,7 @@ impl Provider for Client {
Vec::new() Vec::new()
} }
fn pending_transactions(&self) -> Vec<PendingTransaction> { fn ready_transactions(&self) -> Vec<PendingTransaction> {
Vec::new() Vec::new()
} }
} }

View File

@ -169,8 +169,8 @@ impl Provider for TestProvider {
req.requests.into_iter().map(|_| ::rlp::EMPTY_LIST_RLP.to_vec()).collect() req.requests.into_iter().map(|_| ::rlp::EMPTY_LIST_RLP.to_vec()).collect()
} }
fn pending_transactions(&self) -> Vec<PendingTransaction> { fn ready_transactions(&self) -> Vec<PendingTransaction> {
self.0.client.pending_transactions() self.0.client.ready_transactions()
} }
} }

View File

@ -79,7 +79,7 @@ pub trait Provider: Send + Sync {
fn header_proofs(&self, req: request::HeaderProofs) -> Vec<Bytes>; fn header_proofs(&self, req: request::HeaderProofs) -> Vec<Bytes>;
/// Provide pending transactions. /// Provide pending transactions.
fn pending_transactions(&self) -> Vec<PendingTransaction>; fn ready_transactions(&self) -> Vec<PendingTransaction>;
} }
// Implementation of a light client data provider for a client. // Implementation of a light client data provider for a client.
@ -178,7 +178,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
req.requests.into_iter().map(|_| ::rlp::EMPTY_LIST_RLP.to_vec()).collect() req.requests.into_iter().map(|_| ::rlp::EMPTY_LIST_RLP.to_vec()).collect()
} }
fn pending_transactions(&self) -> Vec<PendingTransaction> { fn ready_transactions(&self) -> Vec<PendingTransaction> {
BlockChainClient::pending_transactions(self) BlockChainClient::ready_transactions(self)
} }
} }

View File

@ -1334,8 +1334,8 @@ impl BlockChainClient for Client {
} }
} }
fn pending_transactions(&self) -> Vec<PendingTransaction> { fn ready_transactions(&self) -> Vec<PendingTransaction> {
self.miner.pending_transactions(self.chain.read().best_block_number()) self.miner.ready_transactions(self.chain.read().best_block_number())
} }
fn queue_consensus_message(&self, message: Bytes) { fn queue_consensus_message(&self, message: Bytes) {

View File

@ -688,8 +688,8 @@ impl BlockChainClient for TestBlockChainClient {
fn broadcast_consensus_message(&self, _message: Bytes) {} fn broadcast_consensus_message(&self, _message: Bytes) {}
fn pending_transactions(&self) -> Vec<PendingTransaction> { fn ready_transactions(&self) -> Vec<PendingTransaction> {
self.miner.pending_transactions(self.chain_info().best_block_number) self.miner.ready_transactions(self.chain_info().best_block_number)
} }
fn signing_network_id(&self) -> Option<u64> { None } fn signing_network_id(&self) -> Option<u64> { None }

View File

@ -211,8 +211,8 @@ pub trait BlockChainClient : Sync + Send {
/// Used by PoA to communicate with peers. /// Used by PoA to communicate with peers.
fn broadcast_consensus_message(&self, message: Bytes); fn broadcast_consensus_message(&self, message: Bytes);
/// list all transactions /// List all transactions that are allowed into the next block.
fn pending_transactions(&self) -> Vec<PendingTransaction>; fn ready_transactions(&self) -> Vec<PendingTransaction>;
/// Sorted list of transaction gas prices from at least last sample_size blocks. /// Sorted list of transaction gas prices from at least last sample_size blocks.
fn gas_price_corpus(&self, sample_size: usize) -> Vec<U256> { fn gas_price_corpus(&self, sample_size: usize) -> Vec<U256> {

View File

@ -909,7 +909,7 @@ impl MinerService for Miner {
imported imported
} }
fn all_transactions(&self) -> Vec<PendingTransaction> { fn pending_transactions(&self) -> Vec<PendingTransaction> {
let queue = self.transaction_queue.lock(); let queue = self.transaction_queue.lock();
queue.pending_transactions(BlockNumber::max_value()) queue.pending_transactions(BlockNumber::max_value())
} }
@ -926,7 +926,7 @@ impl MinerService for Miner {
self.transaction_queue.lock().future_transactions() self.transaction_queue.lock().future_transactions()
} }
fn pending_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction> { fn ready_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction> {
let queue = self.transaction_queue.lock(); let queue = self.transaction_queue.lock();
match self.options.pending_set { match self.options.pending_set {
PendingSet::AlwaysQueue => queue.pending_transactions(best_block), PendingSet::AlwaysQueue => queue.pending_transactions(best_block),
@ -1253,8 +1253,8 @@ mod tests {
// then // then
assert_eq!(res.unwrap(), TransactionImportResult::Current); 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(best_block).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_transactions_hashes(best_block).len(), 1);
assert_eq!(miner.pending_receipts(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) // This method will let us know if pending block was created (before calling that method)
@ -1273,8 +1273,8 @@ mod tests {
// then // then
assert_eq!(res.unwrap(), TransactionImportResult::Current); 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(best_block).len(), 0); assert_eq!(miner.ready_transactions(best_block).len(), 0);
assert_eq!(miner.pending_transactions_hashes(best_block).len(), 0); assert_eq!(miner.pending_transactions_hashes(best_block).len(), 0);
assert_eq!(miner.pending_receipts(best_block).len(), 0); assert_eq!(miner.pending_receipts(best_block).len(), 0);
} }
@ -1291,9 +1291,9 @@ mod tests {
// then // then
assert_eq!(res.unwrap(), TransactionImportResult::Current); 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_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); assert_eq!(miner.pending_receipts(best_block).len(), 0);
// This method will let us know if pending block was created (before calling that method) // This method will let us know if pending block was created (before calling that method)
assert!(miner.prepare_work_sealing(&client)); assert!(miner.prepare_work_sealing(&client));

View File

@ -144,11 +144,11 @@ pub trait MinerService : Send + Sync {
/// Query pending transactions for hash. /// Query pending transactions for hash.
fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<SignedTransaction>; fn transaction(&self, best_block: BlockNumber, hash: &H256) -> Option<SignedTransaction>;
/// Get a list of all ready transactions in the queue. /// Get a list of all pending transactions in the queue.
fn all_transactions(&self) -> Vec<PendingTransaction>; fn pending_transactions(&self) -> Vec<PendingTransaction>;
/// Get a list of all pending transactions. /// Get a list of all transactions that can go into the given block.
fn pending_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction>; fn ready_transactions(&self, best_block: BlockNumber) -> Vec<PendingTransaction>;
/// Get a list of all future transactions. /// Get a list of all future transactions.
fn future_transactions(&self) -> Vec<PendingTransaction>; fn future_transactions(&self) -> Vec<PendingTransaction>;

View File

@ -313,11 +313,11 @@ fn does_not_propagate_delayed_transactions() {
client.miner().import_own_transaction(&**client, tx0).unwrap(); client.miner().import_own_transaction(&**client, tx0).unwrap();
client.miner().import_own_transaction(&**client, tx1).unwrap(); client.miner().import_own_transaction(&**client, tx1).unwrap();
assert_eq!(0, client.pending_transactions().len()); assert_eq!(0, client.ready_transactions().len());
assert_eq!(2, client.miner().all_transactions().len()); assert_eq!(2, client.miner().pending_transactions().len());
push_blocks_to_client(client, 53, 2, 1); push_blocks_to_client(client, 53, 2, 2);
client.import_verified_blocks(); client.import_verified_blocks();
assert_eq!(2, client.pending_transactions().len()); assert_eq!(2, client.ready_transactions().len());
assert_eq!(2, client.miner().all_transactions().len()); assert_eq!(2, client.miner().pending_transactions().len());
} }

View File

@ -270,7 +270,7 @@ impl<C, M, S: ?Sized, U> Parity for ParityClient<C, M, S, U> where
fn pending_transactions(&self) -> Result<Vec<Transaction>, Error> { fn pending_transactions(&self) -> Result<Vec<Transaction>, Error> {
try!(self.active()); try!(self.active());
Ok(take_weak!(self.miner).all_transactions().into_iter().map(Into::into).collect::<Vec<_>>()) Ok(take_weak!(self.miner).pending_transactions().into_iter().map(Into::into).collect::<Vec<_>>())
} }
fn future_transactions(&self) -> Result<Vec<Transaction>, Error> { fn future_transactions(&self) -> Result<Vec<Transaction>, Error> {

View File

@ -204,7 +204,7 @@ impl MinerService for TestMinerService {
self.pending_transactions.lock().get(hash).cloned() self.pending_transactions.lock().get(hash).cloned()
} }
fn all_transactions(&self) -> Vec<PendingTransaction> { fn pending_transactions(&self) -> Vec<PendingTransaction> {
self.pending_transactions.lock().values().cloned().map(Into::into).collect() 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() self.local_transactions.lock().iter().map(|(hash, stats)| (*hash, stats.clone())).collect()
} }
fn pending_transactions(&self, _best_block: BlockNumber) -> Vec<PendingTransaction> { fn ready_transactions(&self, _best_block: BlockNumber) -> Vec<PendingTransaction> {
self.pending_transactions.lock().values().cloned().map(Into::into).collect() self.pending_transactions.lock().values().cloned().map(Into::into).collect()
} }

View File

@ -1919,7 +1919,7 @@ impl ChainSync {
return 0; return 0;
} }
let transactions = io.chain().pending_transactions(); let transactions = io.chain().ready_transactions();
if transactions.is_empty() { if transactions.is_empty() {
return 0; return 0;
} }