Merge Notifier and TransactionsPoolNotifier (#10591)

* Merge `Notifier` and `TransactionsPoolNotifier`

* fix tests
This commit is contained in:
Sfxdx
2019-06-04 18:35:33 +07:00
committed by Seun LanLege
parent 425dcd45c2
commit faf6f1f9ea
8 changed files with 138 additions and 139 deletions

View File

@@ -260,14 +260,16 @@ impl Miner {
}
/// Set a callback to be notified about imported transactions' hashes.
pub fn add_transactions_listener(&self, f: Box<Fn(&[H256]) + Send + Sync>) {
self.transaction_queue.add_listener(f);
pub fn pending_transactions_receiver(&self) -> mpsc::UnboundedReceiver<Arc<Vec<H256>>> {
let (sender, receiver) = mpsc::unbounded();
self.transaction_queue.add_pending_listener(sender);
receiver
}
/// Set a callback to be notified
pub fn tx_pool_receiver(&self) -> mpsc::UnboundedReceiver<Arc<Vec<(H256, TxStatus)>>> {
/// Set a callback to be notified about imported transactions' hashes.
pub fn full_transactions_receiver(&self) -> mpsc::UnboundedReceiver<Arc<Vec<(H256, TxStatus)>>> {
let (sender, receiver) = mpsc::unbounded();
self.transaction_queue.add_tx_pool_listener(sender);
self.transaction_queue.add_full_listener(sender);
receiver
}