From c62e97d3c460ed03067a9817e206625ea9971ca2 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 16 Jul 2019 12:46:13 +0200 Subject: [PATCH] TransactionQueue::import accepts iterator (#10889) --- ethcore/src/miner/miner.rs | 7 +++---- miner/src/pool/queue.rs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index bfb1c543f..03e95c6c4 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -950,7 +950,7 @@ impl miner::MinerService for Miner { let client = self.pool_client(chain); let results = self.transaction_queue.import( client, - transactions.into_iter().map(pool::verifier::Transaction::Unverified).collect(), + transactions.into_iter().map(pool::verifier::Transaction::Unverified), ); // -------------------------------------------------------------------------- @@ -976,7 +976,7 @@ impl miner::MinerService for Miner { let client = self.pool_client(chain); let imported = self.transaction_queue.import( client, - vec![pool::verifier::Transaction::Local(pending)] + Some(pool::verifier::Transaction::Local(pending)) ).pop().expect("one result returned per added transaction; one added => one result; qed"); // -------------------------------------------------------------------------- @@ -1376,8 +1376,7 @@ impl miner::MinerService for Miner { .expect("Client is sending message after commit to db and inserting to chain; the block is available; qed"); let txs = block.transactions() .into_iter() - .map(pool::verifier::Transaction::Retracted) - .collect(); + .map(pool::verifier::Transaction::Retracted); let _ = self.transaction_queue.import( client.clone(), txs, diff --git a/miner/src/pool/queue.rs b/miner/src/pool/queue.rs index 8d804e968..bc79d3424 100644 --- a/miner/src/pool/queue.rs +++ b/miner/src/pool/queue.rs @@ -241,10 +241,10 @@ impl TransactionQueue { /// /// Given blockchain and state access (Client) /// verifies and imports transactions to the pool. - pub fn import( + pub fn import, C: client::Client + client::NonceClient + Clone>( &self, client: C, - transactions: Vec, + transactions: T, ) -> Vec> { // Run verification trace_time!("pool::verify_and_import");