Skip to content

Commit 614bab0

Browse files
committed
all: move main transaction pool into a subpool ethereum#27463
1 parent 932a185 commit 614bab0

37 files changed

+3034
-2207
lines changed

cmd/utils/flags.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
"github.com/XinFinOrg/XDPoSChain/consensus"
4141
"github.com/XinFinOrg/XDPoSChain/consensus/XDPoS"
4242
"github.com/XinFinOrg/XDPoSChain/core"
43-
"github.com/XinFinOrg/XDPoSChain/core/txpool"
43+
"github.com/XinFinOrg/XDPoSChain/core/txpool/legacypool"
4444
"github.com/XinFinOrg/XDPoSChain/core/vm"
4545
"github.com/XinFinOrg/XDPoSChain/crypto"
4646
"github.com/XinFinOrg/XDPoSChain/eth"
@@ -201,20 +201,20 @@ var (
201201
Name: "txpool-journal",
202202
Aliases: []string{"txpool.journal"},
203203
Usage: "Disk journal for local transaction to survive node restarts",
204-
Value: txpool.DefaultConfig.Journal,
204+
Value: ethconfig.Defaults.TxPool.Journal,
205205
Category: flags.TxPoolCategory,
206206
}
207207
TxPoolRejournalFlag = &cli.DurationFlag{
208208
Name: "txpool-rejournal",
209209
Aliases: []string{"txpool.rejournal"},
210210
Usage: "Time interval to regenerate the local transaction journal",
211-
Value: txpool.DefaultConfig.Rejournal,
211+
Value: ethconfig.Defaults.TxPool.Rejournal,
212212
Category: flags.TxPoolCategory,
213213
}
214214
TxPoolPriceLimitFlag = &cli.Uint64Flag{
215215
Name: "txpool-pricelimit",
216216
Aliases: []string{"txpool.pricelimit"},
217-
Usage: "Minimum gas price limit to enforce for acceptance into the pool",
217+
Usage: "Minimum gas price tip to enforce for acceptance into the pool",
218218
Value: ethconfig.Defaults.TxPool.PriceLimit,
219219
Category: flags.TxPoolCategory,
220220
}
@@ -1398,7 +1398,7 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config) {
13981398
}
13991399
}
14001400

1401-
func setTxPool(ctx *cli.Context, cfg *txpool.Config) {
1401+
func setTxPool(ctx *cli.Context, cfg *legacypool.Config) {
14021402
if ctx.IsSet(TxPoolNoLocalsFlag.Name) {
14031403
cfg.NoLocals = ctx.Bool(TxPoolNoLocalsFlag.Name)
14041404
}

contracts/utils.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool,
9393
return err
9494
}
9595
// Add tx signed to local tx pool.
96-
err = pool.AddLocal(txSigned)
96+
err = pool.Add([]*txpool.Transaction{{Tx: txSigned}}, true, true)[0]
9797
if err != nil {
9898
log.Error("Fail to add tx sign to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce)
9999
return err
@@ -121,7 +121,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool,
121121
return err
122122
}
123123
// Add tx signed to local tx pool.
124-
err = pool.AddLocal(txSigned)
124+
err = pool.Add([]*txpool.Transaction{{Tx: txSigned}}, true, true)[0]
125125
if err != nil {
126126
log.Error("Fail to add tx secret to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce)
127127
return err
@@ -150,7 +150,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *txpool.TxPool,
150150
return err
151151
}
152152
// Add tx to pool.
153-
err = pool.AddLocal(txSigned)
153+
err = pool.Add([]*txpool.Transaction{{Tx: txSigned}}, true, true)[0]
154154
if err != nil {
155155
log.Error("Fail to add tx opening to local pool.", "error", err, "number", block.NumberU64(), "hash", block.Hash().Hex(), "from", account.Address, "nonce", nonce)
156156
return err

core/txpool/errors.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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+
// ErrTxPoolOverflow is returned if the transaction pool is full and can't accept
34+
// another remote transaction.
35+
ErrTxPoolOverflow = errors.New("txpool is full")
36+
37+
// ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced
38+
// with a different one without the required price bump.
39+
ErrReplaceUnderpriced = errors.New("replacement transaction underpriced")
40+
41+
// ErrGasLimit is returned if a transaction's requested gas limit exceeds the
42+
// maximum allowance of the current block.
43+
ErrGasLimit = errors.New("exceeds block gas limit")
44+
45+
// ErrNegativeValue is a sanity error to ensure no one is able to specify a
46+
// transaction with a negative value.
47+
ErrNegativeValue = errors.New("negative value")
48+
49+
// ErrOversizedData is returned if the input data of a transaction is greater
50+
// than some meaningful limit a user might use. This is not a consensus error
51+
// making the transaction invalid, rather a DOS protection.
52+
ErrOversizedData = errors.New("oversized data")
53+
54+
// ErrFutureReplacePending is returned if a future transaction replaces a pending
55+
// transaction. Future transactions should only be able to replace other future transactions.
56+
ErrFutureReplacePending = errors.New("future transaction tries to replace pending")
57+
58+
ErrZeroGasPrice = errors.New("zero gas price")
59+
60+
ErrUnderMinGasPrice = errors.New("under min gas price")
61+
62+
ErrDuplicateSpecialTransaction = errors.New("duplicate a special transaction")
63+
64+
ErrMinDeploySMC = errors.New("smart contract creation cost is under allowance")
65+
)
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)