@@ -228,21 +228,6 @@ func (self *TxPool) queueTx(hash common.Hash, tx *types.Transaction) {
228
228
self .queue [from ] = make (map [common.Hash ]* types.Transaction )
229
229
}
230
230
self.queue [from ][hash ] = tx
231
-
232
- if len (self .queue [from ]) > maxQueued {
233
- var (
234
- worstHash common.Hash
235
- worstNonce uint64
236
- )
237
- for hash , tx := range self .queue [from ] {
238
- if tx .Nonce () > worstNonce {
239
- worstNonce = tx .Nonce ()
240
- worstHash = hash
241
- }
242
- }
243
- glog .V (logger .Debug ).Infof ("Queued tx limit exceeded for %x. Removed worst nonce tx: %x\n " , common .PP (from [:]), common .PP (worstHash [:]))
244
- delete (self .queue [from ], worstHash )
245
- }
246
231
}
247
232
248
233
// addTx will add a transaction to the pending (processable queue) list of transactions
@@ -367,7 +352,16 @@ func (pool *TxPool) checkQueue() {
367
352
// Find the next consecutive nonce range starting at the
368
353
// current account nonce.
369
354
sort .Sort (addq )
370
- for _ , e := range addq {
355
+ for i , e := range addq {
356
+ // start deleting the transactions from the queue if they exceed the limit
357
+ if i > maxQueued {
358
+ if glog .V (logger .Debug ) {
359
+ glog .Infof ("Queued tx limit exceeded for %s. Tx %s removed\n " , common .PP (address [:]), common .PP (e .hash [:]))
360
+ }
361
+ delete (pool .queue [address ], e .hash )
362
+ continue
363
+ }
364
+
371
365
if e .AccountNonce > guessedNonce {
372
366
break
373
367
}
0 commit comments