Skip to content

Commit 13b0d09

Browse files
committed
all: move main transaction pool into a subpool
1 parent 8bbaf88 commit 13b0d09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2915
-2101
lines changed

cmd/utils/flags.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141
"github.com/ethereum/go-ethereum/common/hexutil"
4242
"github.com/ethereum/go-ethereum/core"
4343
"github.com/ethereum/go-ethereum/core/rawdb"
44-
"github.com/ethereum/go-ethereum/core/txpool"
44+
"github.com/ethereum/go-ethereum/core/txpool/legacypool"
4545
"github.com/ethereum/go-ethereum/core/types"
4646
"github.com/ethereum/go-ethereum/core/vm"
4747
"github.com/ethereum/go-ethereum/crypto"
@@ -334,18 +334,18 @@ var (
334334
TxPoolJournalFlag = &cli.StringFlag{
335335
Name: "txpool.journal",
336336
Usage: "Disk journal for local transaction to survive node restarts",
337-
Value: txpool.DefaultConfig.Journal,
337+
Value: ethconfig.Defaults.TxPool.Journal,
338338
Category: flags.TxPoolCategory,
339339
}
340340
TxPoolRejournalFlag = &cli.DurationFlag{
341341
Name: "txpool.rejournal",
342342
Usage: "Time interval to regenerate the local transaction journal",
343-
Value: txpool.DefaultConfig.Rejournal,
343+
Value: ethconfig.Defaults.TxPool.Rejournal,
344344
Category: flags.TxPoolCategory,
345345
}
346346
TxPoolPriceLimitFlag = &cli.Uint64Flag{
347347
Name: "txpool.pricelimit",
348-
Usage: "Minimum gas price limit to enforce for acceptance into the pool",
348+
Usage: "Minimum gas price tip to enforce for acceptance into the pool",
349349
Value: ethconfig.Defaults.TxPool.PriceLimit,
350350
Category: flags.TxPoolCategory,
351351
}
@@ -385,7 +385,6 @@ var (
385385
Value: ethconfig.Defaults.TxPool.Lifetime,
386386
Category: flags.TxPoolCategory,
387387
}
388-
389388
// Performance tuning settings
390389
CacheFlag = &cli.IntFlag{
391390
Name: "cache",
@@ -1500,7 +1499,7 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config, light bool) {
15001499
}
15011500
}
15021501

1503-
func setTxPool(ctx *cli.Context, cfg *txpool.Config) {
1502+
func setTxPool(ctx *cli.Context, cfg *legacypool.Config) {
15041503
if ctx.IsSet(TxPoolLocalsFlag.Name) {
15051504
locals := strings.Split(ctx.String(TxPoolLocalsFlag.Name), ",")
15061505
for _, account := range locals {

core/txpool/errors.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2014 The go-ethereum Authors
2+
// This file is part of the go-ethereum library.
3+
//
4+
// The go-ethereum library is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// The go-ethereum library is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
16+
17+
package txpool
18+
19+
import "errors"
20+
21+
var (
22+
// ErrAlreadyKnown is returned if the transactions is already contained
23+
// within the pool.
24+
ErrAlreadyKnown = errors.New("already known")
25+
26+
// ErrInvalidSender is returned if the transaction contains an invalid signature.
27+
ErrInvalidSender = errors.New("invalid sender")
28+
29+
// ErrUnderpriced is returned if a transaction's gas price is below the minimum
30+
// configured for the transaction pool.
31+
ErrUnderpriced = errors.New("transaction underpriced")
32+
33+
// ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced
34+
// with a different one without the required price bump.
35+
ErrReplaceUnderpriced = errors.New("replacement transaction underpriced")
36+
37+
// ErrGasLimit is returned if a transaction's requested gas limit exceeds the
38+
// maximum allowance of the current block.
39+
ErrGasLimit = errors.New("exceeds block gas limit")
40+
41+
// ErrNegativeValue is a sanity error to ensure no one is able to specify a
42+
// transaction with a negative value.
43+
ErrNegativeValue = errors.New("negative value")
44+
45+
// ErrOversizedData is returned if the input data of a transaction is greater
46+
// than some meaningful limit a user might use. This is not a consensus error
47+
// making the transaction invalid, rather a DOS protection.
48+
ErrOversizedData = errors.New("oversized data")
49+
50+
// ErrFutureReplacePending is returned if a future transaction replaces a pending
51+
// transaction. Future transactions should only be able to replace other future transactions.
52+
ErrFutureReplacePending = errors.New("future transaction tries to replace pending")
53+
)

core/txpool/journal.go renamed to core/txpool/legacypool/journal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU Lesser General Public License
1515
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616

17-
package txpool
17+
package legacypool
1818

1919
import (
2020
"errors"

0 commit comments

Comments
 (0)