@@ -396,7 +396,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
396
396
}
397
397
// Drop non-local transactions under our own minimal accepted gas price
398
398
local = local || pool .locals .contains (from ) // account may be local even if the transaction arrived from the network
399
- if ( ! local || pool . config . NoLocals ) && pool .gasPrice .Cmp (tx .GasPrice ()) > 0 {
399
+ if ! local && pool .gasPrice .Cmp (tx .GasPrice ()) > 0 {
400
400
return ErrUnderpriced
401
401
}
402
402
// Ensure the transaction adheres to nonce ordering
@@ -482,7 +482,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) {
482
482
if err != nil {
483
483
return false , err
484
484
}
485
- if local && ! pool . config . NoLocals {
485
+ if local {
486
486
pool .locals .add (from )
487
487
}
488
488
log .Trace ("Pooled new future transaction" , "hash" , hash , "from" , from , "to" , tx .To ())
@@ -556,7 +556,7 @@ func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.T
556
556
// the sender as a local one in the mean time, ensuring it goes around the local
557
557
// pricing constraints.
558
558
func (pool * TxPool ) AddLocal (tx * types.Transaction ) error {
559
- return pool .addTx (tx , true )
559
+ return pool .addTx (tx , ! pool . config . NoLocals )
560
560
}
561
561
562
562
// AddRemote enqueues a single transaction into the pool if it is valid. If the
@@ -570,7 +570,7 @@ func (pool *TxPool) AddRemote(tx *types.Transaction) error {
570
570
// marking the senders as a local ones in the mean time, ensuring they go around
571
571
// the local pricing constraints.
572
572
func (pool * TxPool ) AddLocals (txs []* types.Transaction ) error {
573
- return pool .addTxs (txs , true )
573
+ return pool .addTxs (txs , ! pool . config . NoLocals )
574
574
}
575
575
576
576
// AddRemotes enqueues a batch of transactions into the pool if they are valid.
@@ -924,6 +924,11 @@ func (pool *TxPool) expirationLoop() {
924
924
case <- evict .C :
925
925
pool .mu .Lock ()
926
926
for addr := range pool .queue {
927
+ // Skip local transactions from the eviction mechanism
928
+ if pool .locals .contains (addr ) {
929
+ continue
930
+ }
931
+ // Any non-locals old enough should be removed
927
932
if time .Since (pool .beats [addr ]) > pool .config .Lifetime {
928
933
for _ , tx := range pool .queue [addr ].Flatten () {
929
934
pool .removeTx (tx .Hash ())
0 commit comments