Răsfoiți Sursa

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

Wenbiao Zheng 7 ani în urmă
părinte
comite
52b1d09457
1 a modificat fișierele cu 3 adăugiri și 5 ștergeri
  1. 3 5
      core/tx_pool.go

+ 3 - 5
core/tx_pool.go

@@ -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 {
-				from, _ := types.Sender(pool.signer, tx) // already validated
-				dirty[from] = struct{}{}
-			}
+		if replace, errs[i] = pool.add(tx, local); errs[i] == nil && !replace {
+			from, _ := types.Sender(pool.signer, tx) // already validated
+			dirty[from] = struct{}{}
 		}
 		}
 	}
 	}
 	// Only reprocess the internal state if something was actually added
 	// Only reprocess the internal state if something was actually added