core: reduce nesting in transaction pool code (#16980)

This commit is contained in:
Wenbiao Zheng 2018-06-14 18:46:43 +08:00 committed by Péter Szilágyi
parent 9402f96597
commit 52b1d09457
1 changed files with 3 additions and 5 deletions

View File

@ -815,11 +815,9 @@ func (pool *TxPool) addTxsLocked(txs []*types.Transaction, local bool) []error {
for i, tx := range txs { for i, tx := range txs {
var replace bool var replace bool
if replace, errs[i] = pool.add(tx, local); errs[i] == nil { if replace, errs[i] = pool.add(tx, local); errs[i] == nil && !replace {
if !replace { from, _ := types.Sender(pool.signer, tx) // already validated
from, _ := types.Sender(pool.signer, tx) // already validated dirty[from] = struct{}{}
dirty[from] = struct{}{}
}
} }
} }
// Only reprocess the internal state if something was actually added // Only reprocess the internal state if something was actually added