Disable parallel verification and skip verifiying already imported txs. (#8834)
* Reject transactions that are already in pool without verifying them. * Avoid verifying already imported transactions.
This commit is contained in:
committed by
Afri Schoedon
parent
13bc922e54
commit
af1088ef61
@@ -23,7 +23,6 @@ use std::collections::BTreeMap;
|
||||
|
||||
use ethereum_types::{H256, U256, Address};
|
||||
use parking_lot::RwLock;
|
||||
use rayon::prelude::*;
|
||||
use transaction;
|
||||
use txpool::{self, Verifier};
|
||||
|
||||
@@ -179,8 +178,14 @@ impl TransactionQueue {
|
||||
|
||||
let verifier = verifier::Verifier::new(client, options, self.insertion_id.clone());
|
||||
let results = transactions
|
||||
.into_par_iter()
|
||||
.map(|transaction| verifier.verify_transaction(transaction))
|
||||
.into_iter()
|
||||
.map(|transaction| {
|
||||
if self.pool.read().find(&transaction.hash()).is_some() {
|
||||
bail!(transaction::Error::AlreadyImported)
|
||||
}
|
||||
|
||||
verifier.verify_transaction(transaction)
|
||||
})
|
||||
.map(|result| result.and_then(|verified| {
|
||||
self.pool.write().import(verified)
|
||||
.map(|_imported| ())
|
||||
|
||||
Reference in New Issue
Block a user