Watch transactions pool (#10558)

adds `parity_watchTransactionsPool`
This commit is contained in:
IntegralTeam
2019-04-12 18:36:49 +07:00
committed by Seun LanLege
parent 90a7ca9d10
commit 944bf6a59e
18 changed files with 297 additions and 8 deletions

View File

@@ -74,6 +74,7 @@ extern crate ethcore_miner;
extern crate ethereum_types;
extern crate ethjson;
extern crate ethkey;
extern crate futures;
extern crate hash_db;
extern crate heapsize;
extern crate itertools;

View File

@@ -24,11 +24,12 @@ use bytes::Bytes;
use call_contract::CallContract;
use ethcore_miner::gas_pricer::GasPricer;
use ethcore_miner::local_accounts::LocalAccounts;
use ethcore_miner::pool::{self, TransactionQueue, VerifiedTransaction, QueueStatus, PrioritizationStrategy};
use ethcore_miner::pool::{self, TransactionQueue, VerifiedTransaction, QueueStatus, PrioritizationStrategy, TxStatus};
use ethcore_miner::service_transaction_checker::ServiceTransactionChecker;
#[cfg(feature = "work-notify")]
use ethcore_miner::work_notify::NotifyWork;
use ethereum_types::{H256, U256, Address};
use futures::sync::mpsc;
use io::IoChannel;
use miner::pool_client::{PoolClient, CachedNonceClient, NonceCache};
use miner;
@@ -263,6 +264,13 @@ impl Miner {
self.transaction_queue.add_listener(f);
}
/// Set a callback to be notified
pub fn tx_pool_receiver(&self) -> mpsc::UnboundedReceiver<Arc<Vec<(H256, TxStatus)>>> {
let (sender, receiver) = mpsc::unbounded();
self.transaction_queue.add_tx_pool_listener(sender);
receiver
}
/// Creates new instance of miner Arc.
pub fn new<A: LocalAccounts + 'static>(
options: MinerOptions,