18
18
package legacypool
19
19
20
20
import (
21
- "errors"
22
21
"maps"
23
22
"math/big"
24
23
"slices"
@@ -31,6 +30,7 @@ import (
31
30
"github.com/ethereum/go-ethereum/common/prque"
32
31
"github.com/ethereum/go-ethereum/consensus/misc/eip1559"
33
32
"github.com/ethereum/go-ethereum/core"
33
+ "github.com/ethereum/go-ethereum/core/txpool/legacypool"
34
34
"github.com/ethereum/go-ethereum/core/types"
35
35
"github.com/ethereum/go-ethereum/core/vm"
36
36
"github.com/ethereum/go-ethereum/crypto/kzg4844"
@@ -58,25 +58,6 @@ const (
58
58
txMaxSize = 4 * txSlotSize // 128KB
59
59
)
60
60
61
- var (
62
- // ErrTxPoolOverflow is returned if the transaction pool is full and can't accept
63
- // another remote transaction.
64
- ErrTxPoolOverflow = errors .New ("txpool is full" )
65
-
66
- // ErrOutOfOrderTxFromDelegated is returned when the transaction with gapped
67
- // nonce received from the accounts with delegation or pending delegation.
68
- ErrOutOfOrderTxFromDelegated = errors .New ("gapped-nonce tx from delegated accounts" )
69
-
70
- // ErrAuthorityReserved is returned if a transaction has an authorization
71
- // signed by an address which already has in-flight transactions known to the
72
- // pool.
73
- ErrAuthorityReserved = errors .New ("authority already reserved" )
74
-
75
- // ErrFutureReplacePending is returned if a future transaction replaces a pending
76
- // one. Future transactions should only be able to replace other future transactions.
77
- ErrFutureReplacePending = errors .New ("future transaction tries to replace pending" )
78
- )
79
-
80
61
var (
81
62
evictionInterval = time .Minute // Time interval to check for evictable transactions
82
63
statsReportInterval = 8 * time .Second // Time interval to report transaction pool stats
@@ -623,7 +604,7 @@ func (pool *LegacyPool) checkDelegationLimit(tx *types.Transaction) error {
623
604
if pending == nil {
624
605
// Transaction with gapped nonce is not supported for delegated accounts
625
606
if pool .pendingNonces .get (from ) != tx .Nonce () {
626
- return ErrOutOfOrderTxFromDelegated
607
+ return legacypool . ErrOutOfOrderTxFromDelegated
627
608
}
628
609
return nil
629
610
}
@@ -654,7 +635,7 @@ func (pool *LegacyPool) validateAuth(tx *types.Transaction) error {
654
635
count += queue .Len ()
655
636
}
656
637
if count > 1 {
657
- return ErrAuthorityReserved
638
+ return legacypool . ErrAuthorityReserved
658
639
}
659
640
// Because there is no exclusive lock held between different subpools
660
641
// when processing transactions, the SetCode transaction may be accepted
@@ -665,7 +646,7 @@ func (pool *LegacyPool) validateAuth(tx *types.Transaction) error {
665
646
// that attackers cannot easily stack a SetCode transaction when the sender
666
647
// is reserved by other pools.
667
648
if pool .reserver .Has (auth ) {
668
- return ErrAuthorityReserved
649
+ return legacypool . ErrAuthorityReserved
669
650
}
670
651
}
671
652
}
@@ -730,7 +711,7 @@ func (pool *LegacyPool) add(tx *types.Transaction) (replaced bool, err error) {
730
711
// replacements to 25% of the slots
731
712
if pool .changesSinceReorg > int (pool .config .GlobalSlots / 4 ) {
732
713
throttleTxMeter .Mark (1 )
733
- return false , ErrTxPoolOverflow
714
+ return false , legacypool . ErrTxPoolOverflow
734
715
}
735
716
736
717
// New transaction is better than our worse ones, make room for it.
@@ -741,7 +722,7 @@ func (pool *LegacyPool) add(tx *types.Transaction) (replaced bool, err error) {
741
722
if ! success {
742
723
log .Trace ("Discarding overflown transaction" , "hash" , hash )
743
724
overflowedTxMeter .Mark (1 )
744
- return false , ErrTxPoolOverflow
725
+ return false , legacypool . ErrTxPoolOverflow
745
726
}
746
727
747
728
// If the new transaction is a future transaction it should never churn pending transactions
@@ -760,7 +741,7 @@ func (pool *LegacyPool) add(tx *types.Transaction) (replaced bool, err error) {
760
741
pool .priced .Put (dropTx )
761
742
}
762
743
log .Trace ("Discarding future transaction replacing pending tx" , "hash" , hash )
763
- return false , ErrFutureReplacePending
744
+ return false , legacypool . ErrFutureReplacePending
764
745
}
765
746
}
766
747
0 commit comments