TransactionQueue::import accepts iterator (#10889)
This commit is contained in:
parent
27d1c2d7d1
commit
c62e97d3c4
@ -950,7 +950,7 @@ impl miner::MinerService for Miner {
|
|||||||
let client = self.pool_client(chain);
|
let client = self.pool_client(chain);
|
||||||
let results = self.transaction_queue.import(
|
let results = self.transaction_queue.import(
|
||||||
client,
|
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 client = self.pool_client(chain);
|
||||||
let imported = self.transaction_queue.import(
|
let imported = self.transaction_queue.import(
|
||||||
client,
|
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");
|
).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");
|
.expect("Client is sending message after commit to db and inserting to chain; the block is available; qed");
|
||||||
let txs = block.transactions()
|
let txs = block.transactions()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(pool::verifier::Transaction::Retracted)
|
.map(pool::verifier::Transaction::Retracted);
|
||||||
.collect();
|
|
||||||
let _ = self.transaction_queue.import(
|
let _ = self.transaction_queue.import(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
txs,
|
txs,
|
||||||
|
@ -241,10 +241,10 @@ impl TransactionQueue {
|
|||||||
///
|
///
|
||||||
/// Given blockchain and state access (Client)
|
/// Given blockchain and state access (Client)
|
||||||
/// verifies and imports transactions to the pool.
|
/// verifies and imports transactions to the pool.
|
||||||
pub fn import<C: client::Client + client::NonceClient + Clone>(
|
pub fn import<T: IntoIterator<Item = verifier::Transaction>, C: client::Client + client::NonceClient + Clone>(
|
||||||
&self,
|
&self,
|
||||||
client: C,
|
client: C,
|
||||||
transactions: Vec<verifier::Transaction>,
|
transactions: T,
|
||||||
) -> Vec<Result<(), transaction::Error>> {
|
) -> Vec<Result<(), transaction::Error>> {
|
||||||
// Run verification
|
// Run verification
|
||||||
trace_time!("pool::verify_and_import");
|
trace_time!("pool::verify_and_import");
|
||||||
|
Loading…
Reference in New Issue
Block a user