File tree Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Expand file tree Collapse file tree 1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -339,17 +339,6 @@ func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error) {
339
339
pool .mu .Lock ()
340
340
defer pool .mu .Unlock ()
341
341
342
- state , err := pool .currentState ()
343
- if err != nil {
344
- return nil , err
345
- }
346
-
347
- // check queue first
348
- pool .promoteExecutables (state )
349
-
350
- // invalidate any txs
351
- pool .demoteUnexecutables (state )
352
-
353
342
pending := make (map [common.Address ]types.Transactions )
354
343
for addr , list := range pool .pending {
355
344
pending [addr ] = list .Flatten ()
@@ -551,12 +540,12 @@ func (pool *TxPool) Add(tx *types.Transaction) error {
551
540
if err != nil {
552
541
return err
553
542
}
554
- state , err := pool .currentState ()
555
- if err != nil {
556
- return err
557
- }
558
543
// If we added a new transaction, run promotion checks and return
559
544
if ! replace {
545
+ state , err := pool .currentState ()
546
+ if err != nil {
547
+ return err
548
+ }
560
549
pool .promoteExecutables (state )
561
550
}
562
551
return nil
@@ -579,11 +568,11 @@ func (pool *TxPool) AddBatch(txs []*types.Transaction) error {
579
568
}
580
569
// Only reprocess the internal state if something was actually added
581
570
if added > 0 {
582
- state , err := pool .currentState ()
583
- if err != nil {
584
- return err
585
- }
586
571
if ! replaced {
572
+ state , err := pool .currentState ()
573
+ if err != nil {
574
+ return err
575
+ }
587
576
pool .promoteExecutables (state )
588
577
}
589
578
}
You can’t perform that action at this time.
0 commit comments