diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java index 07fdf82d4d..0954d843c2 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java @@ -33,9 +33,7 @@ import tech.pegasys.pantheon.ethereum.mainnet.TransactionValidator.TransactionInvalidReason; import tech.pegasys.pantheon.ethereum.mainnet.ValidationResult; -import java.util.ArrayList; import java.util.Collection; -import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Optional; @@ -106,11 +104,11 @@ public ValidationResult addLocalTransaction( } public void addRemoteTransactions(final Collection transactions) { + if (!syncState.isInSync(SYNC_TOLERANCE)) { + return; + } final Set addedTransactions = new HashSet<>(); - for (final Transaction transaction : sortByNonce(transactions)) { - if (!syncState.isInSync(SYNC_TOLERANCE)) { - return; - } + for (final Transaction transaction : transactions) { final ValidationResult validationResult = validateTransaction(transaction); if (validationResult.isValid()) { @@ -130,13 +128,6 @@ public void addRemoteTransactions(final Collection transactions) { } } - // Sort transactions by nonce to ensure we import sequences of transactions correctly - private List sortByNonce(final Collection transactions) { - final List sortedTransactions = new ArrayList<>(transactions); - sortedTransactions.sort(Comparator.comparing(Transaction::getNonce)); - return sortedTransactions; - } - public void addTransactionListener(final PendingTransactionListener listener) { pendingTransactions.addTransactionListener(listener); }