Add filtering capability to parity_pendingTransactions (issue 8269) (#10506)
* expand parameters for pending_transactions() * move ready_transactions content into filtered method * apply filter based on tx_hash, sender or receiver * call filtered transactions from RPC interface * attempt at testing... * replace parameters with _ on light client * addes some comments * removed uncompleted tests in miner.rs * attempt at testing, needs more work... * Formatting for ready_transactions_filtered Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Use map_or instead of if-let Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * additional map_or replacement * change receiver type to Option<Option<Address>> * remove faulty MiningService tests, test RPC later * remove tx hash from pending transaction filtering * as_unsigned() method for SignedTransaction * implement Deserialize for FilterOptions * implement Validate for MapAccess type * additional formatting * directly name cover in pattern matching * test valid vull deserialization * test valid sender operators * test valid receiver operators * test valid gas operators * test valid gas price operators * test valid value operators * test valid nonce operators * additional tsets for defaults, unknown filter types, unknown operators and some renames * move filter_options to ethcore to avoid package cycling * adjusted function/method parameters for FilterOptions * implement filter for sender and receiver * implement filter for gas * implement filter for gas price, tx value and nonce * improve filtering implementation; use common function, use combinators * improved documentation for FilterOptions * small documentation adjustments * remove warnings * replace FilterOperator::ContractCreation with FilterOperator::Eq(None) * implement validate_receiver * make small changes like renames, preamble * cleanup code according to suggestions, add docs * small improvements like formatting and newline
This commit is contained in:
@@ -26,6 +26,7 @@ use ethstore::random_phrase;
|
||||
use sync::{LightSyncInfo, LightSyncProvider, LightNetworkDispatcher, ManageNetwork};
|
||||
use updater::VersionInfo as UpdaterVersionInfo;
|
||||
use ethereum_types::{H64, H160, H256, H512, U64, U256};
|
||||
use ethcore::miner::FilterOptions;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
|
||||
use jsonrpc_core::{Result, BoxFuture};
|
||||
@@ -217,7 +218,7 @@ where
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
fn pending_transactions(&self, limit: Option<usize>) -> Result<Vec<Transaction>> {
|
||||
fn pending_transactions(&self, limit: Option<usize>, _filter: Option<FilterOptions>) -> Result<Vec<Transaction>> {
|
||||
let txq = self.light_dispatch.transaction_queue.read();
|
||||
let chain_info = self.light_dispatch.client.chain_info();
|
||||
Ok(
|
||||
|
||||
@@ -22,7 +22,7 @@ use std::collections::BTreeMap;
|
||||
use crypto::DEFAULT_MAC;
|
||||
use ethereum_types::{Address, H64, H160, H256, H512, U64, U256};
|
||||
use ethcore::client::{BlockChainClient, StateClient, Call};
|
||||
use ethcore::miner::{self, MinerService};
|
||||
use ethcore::miner::{self, MinerService, FilterOptions};
|
||||
use ethcore::snapshot::{SnapshotService, RestorationStatus};
|
||||
use ethcore::state::StateInfo;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
@@ -245,10 +245,11 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
fn pending_transactions(&self, limit: Option<usize>) -> Result<Vec<Transaction>> {
|
||||
let ready_transactions = self.miner.ready_transactions(
|
||||
fn pending_transactions(&self, limit: Option<usize>, filter: Option<FilterOptions>) -> Result<Vec<Transaction>> {
|
||||
let ready_transactions = self.miner.ready_transactions_filtered(
|
||||
&*self.client,
|
||||
limit.unwrap_or_else(usize::max_value),
|
||||
filter,
|
||||
miner::PendingOrdering::Priority,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user