eth: move eth.Config to a common package (#22205)

This moves the eth config definition into a separate package, eth/ethconfig. 
Packages eth and les can now import this common package instead of
importing eth from les, reducing dependencies.

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
gary rong
2021-02-05 20:51:15 +08:00
committed by GitHub
parent 28121324ac
commit 098a2b6e26
22 changed files with 265 additions and 215 deletions

View File

@ -20,7 +20,7 @@ import (
"fmt"
"strings"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/node"
"gopkg.in/urfave/cli.v1"
)
@ -55,12 +55,12 @@ var (
LegacyMinerGasTargetFlag = cli.Uint64Flag{
Name: "targetgaslimit",
Usage: "Target gas floor for mined blocks (deprecated, use --miner.gastarget)",
Value: eth.DefaultConfig.Miner.GasFloor,
Value: ethconfig.Defaults.Miner.GasFloor,
}
LegacyMinerGasPriceFlag = BigFlag{
Name: "gasprice",
Usage: "Minimum gas price for mining a transaction (deprecated, use --miner.gasprice)",
Value: eth.DefaultConfig.Miner.GasPrice,
Value: ethconfig.Defaults.Miner.GasPrice,
}
LegacyMinerEtherbaseFlag = cli.StringFlag{
Name: "etherbase",
@ -76,12 +76,12 @@ var (
LegacyLightServFlag = cli.IntFlag{
Name: "lightserv",
Usage: "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)",
Value: eth.DefaultConfig.LightServ,
Value: ethconfig.Defaults.LightServ,
}
LegacyLightPeersFlag = cli.IntFlag{
Name: "lightpeers",
Usage: "Maximum number of light clients to serve, or light servers to attach to (deprecated, use --light.maxpeers)",
Value: eth.DefaultConfig.LightPeers,
Value: ethconfig.Defaults.LightPeers,
}
// (Deprecated April 2020)
@ -143,12 +143,12 @@ var (
LegacyGpoBlocksFlag = cli.IntFlag{
Name: "gpoblocks",
Usage: "Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks)",
Value: eth.DefaultConfig.GPO.Blocks,
Value: ethconfig.Defaults.GPO.Blocks,
}
LegacyGpoPercentileFlag = cli.IntFlag{
Name: "gpopercentile",
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile)",
Value: eth.DefaultConfig.GPO.Percentile,
Value: ethconfig.Defaults.GPO.Percentile,
}
LegacyBootnodesV4Flag = cli.StringFlag{
Name: "bootnodesv4",