Merge pull request #17402 from karalabe/deprecate-flags
cmd: polish miner flags, deprecate olds, add upgrade path
This commit is contained in:
commit
e598ae5c01
@ -48,7 +48,6 @@ var (
|
|||||||
ArgsUsage: "<genesisPath>",
|
ArgsUsage: "<genesisPath>",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.LightModeFlag,
|
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
@ -66,7 +65,7 @@ It expects the genesis file as argument.`,
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.CacheFlag,
|
utils.CacheFlag,
|
||||||
utils.LightModeFlag,
|
utils.SyncModeFlag,
|
||||||
utils.GCModeFlag,
|
utils.GCModeFlag,
|
||||||
utils.CacheDatabaseFlag,
|
utils.CacheDatabaseFlag,
|
||||||
utils.CacheGCFlag,
|
utils.CacheGCFlag,
|
||||||
@ -87,7 +86,7 @@ processing will proceed even if an individual RLP-file import failure occurs.`,
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.CacheFlag,
|
utils.CacheFlag,
|
||||||
utils.LightModeFlag,
|
utils.SyncModeFlag,
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
@ -105,7 +104,7 @@ be gzipped.`,
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.CacheFlag,
|
utils.CacheFlag,
|
||||||
utils.LightModeFlag,
|
utils.SyncModeFlag,
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
@ -119,7 +118,7 @@ be gzipped.`,
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.CacheFlag,
|
utils.CacheFlag,
|
||||||
utils.LightModeFlag,
|
utils.SyncModeFlag,
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
@ -149,7 +148,6 @@ The first argument must be the directory containing the blockchain to download f
|
|||||||
ArgsUsage: " ",
|
ArgsUsage: " ",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.LightModeFlag,
|
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
@ -163,7 +161,7 @@ Remove blockchain and state databases`,
|
|||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.DataDirFlag,
|
utils.DataDirFlag,
|
||||||
utils.CacheFlag,
|
utils.CacheFlag,
|
||||||
utils.LightModeFlag,
|
utils.SyncModeFlag,
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
|
@ -82,8 +82,6 @@ var (
|
|||||||
utils.TxPoolAccountQueueFlag,
|
utils.TxPoolAccountQueueFlag,
|
||||||
utils.TxPoolGlobalQueueFlag,
|
utils.TxPoolGlobalQueueFlag,
|
||||||
utils.TxPoolLifetimeFlag,
|
utils.TxPoolLifetimeFlag,
|
||||||
utils.FastSyncFlag,
|
|
||||||
utils.LightModeFlag,
|
|
||||||
utils.SyncModeFlag,
|
utils.SyncModeFlag,
|
||||||
utils.GCModeFlag,
|
utils.GCModeFlag,
|
||||||
utils.LightServFlag,
|
utils.LightServFlag,
|
||||||
@ -96,12 +94,18 @@ var (
|
|||||||
utils.ListenPortFlag,
|
utils.ListenPortFlag,
|
||||||
utils.MaxPeersFlag,
|
utils.MaxPeersFlag,
|
||||||
utils.MaxPendingPeersFlag,
|
utils.MaxPendingPeersFlag,
|
||||||
utils.EtherbaseFlag,
|
|
||||||
utils.GasPriceFlag,
|
|
||||||
utils.MiningEnabledFlag,
|
utils.MiningEnabledFlag,
|
||||||
utils.MinerThreadsFlag,
|
utils.MinerThreadsFlag,
|
||||||
|
utils.MinerLegacyThreadsFlag,
|
||||||
utils.MinerNotifyFlag,
|
utils.MinerNotifyFlag,
|
||||||
utils.TargetGasLimitFlag,
|
utils.MinerGasTargetFlag,
|
||||||
|
utils.MinerLegacyGasTargetFlag,
|
||||||
|
utils.MinerGasPriceFlag,
|
||||||
|
utils.MinerLegacyGasPriceFlag,
|
||||||
|
utils.MinerEtherbaseFlag,
|
||||||
|
utils.MinerLegacyEtherbaseFlag,
|
||||||
|
utils.MinerExtraDataFlag,
|
||||||
|
utils.MinerLegacyExtraDataFlag,
|
||||||
utils.NATFlag,
|
utils.NATFlag,
|
||||||
utils.NoDiscoverFlag,
|
utils.NoDiscoverFlag,
|
||||||
utils.DiscoveryV5Flag,
|
utils.DiscoveryV5Flag,
|
||||||
@ -122,7 +126,6 @@ var (
|
|||||||
utils.NoCompactionFlag,
|
utils.NoCompactionFlag,
|
||||||
utils.GpoBlocksFlag,
|
utils.GpoBlocksFlag,
|
||||||
utils.GpoPercentileFlag,
|
utils.GpoPercentileFlag,
|
||||||
utils.ExtraDataFlag,
|
|
||||||
configFileFlag,
|
configFileFlag,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +327,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||||||
// Start auxiliary services if enabled
|
// Start auxiliary services if enabled
|
||||||
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) {
|
if ctx.GlobalBool(utils.MiningEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) {
|
||||||
// Mining only makes sense if a full Ethereum node is running
|
// Mining only makes sense if a full Ethereum node is running
|
||||||
if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
|
if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
|
||||||
utils.Fatalf("Light clients do not support mining")
|
utils.Fatalf("Light clients do not support mining")
|
||||||
}
|
}
|
||||||
var ethereum *eth.Ethereum
|
var ethereum *eth.Ethereum
|
||||||
@ -332,7 +335,11 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||||||
utils.Fatalf("Ethereum service not running: %v", err)
|
utils.Fatalf("Ethereum service not running: %v", err)
|
||||||
}
|
}
|
||||||
// Use a reduced number of threads if requested
|
// Use a reduced number of threads if requested
|
||||||
if threads := ctx.GlobalInt(utils.MinerThreadsFlag.Name); threads > 0 {
|
threads := ctx.GlobalInt(utils.MinerLegacyThreadsFlag.Name)
|
||||||
|
if ctx.GlobalIsSet(utils.MinerThreadsFlag.Name) {
|
||||||
|
threads = ctx.GlobalInt(utils.MinerThreadsFlag.Name)
|
||||||
|
}
|
||||||
|
if threads > 0 {
|
||||||
type threaded interface {
|
type threaded interface {
|
||||||
SetThreads(threads int)
|
SetThreads(threads int)
|
||||||
}
|
}
|
||||||
@ -341,7 +348,11 @@ func startNode(ctx *cli.Context, stack *node.Node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Set the gas price to the limits from the CLI and start mining
|
// Set the gas price to the limits from the CLI and start mining
|
||||||
ethereum.TxPool().SetGasPrice(utils.GlobalBig(ctx, utils.GasPriceFlag.Name))
|
gasprice := utils.GlobalBig(ctx, utils.MinerLegacyGasPriceFlag.Name)
|
||||||
|
if ctx.IsSet(utils.MinerGasPriceFlag.Name) {
|
||||||
|
gasprice = utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
||||||
|
}
|
||||||
|
ethereum.TxPool().SetGasPrice(gasprice)
|
||||||
if err := ethereum.StartMining(true); err != nil {
|
if err := ethereum.StartMining(true); err != nil {
|
||||||
utils.Fatalf("Failed to start mining: %v", err)
|
utils.Fatalf("Failed to start mining: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,10 @@ var AppHelpFlagGroups = []flagGroup{
|
|||||||
utils.MiningEnabledFlag,
|
utils.MiningEnabledFlag,
|
||||||
utils.MinerThreadsFlag,
|
utils.MinerThreadsFlag,
|
||||||
utils.MinerNotifyFlag,
|
utils.MinerNotifyFlag,
|
||||||
utils.EtherbaseFlag,
|
utils.MinerGasPriceFlag,
|
||||||
utils.TargetGasLimitFlag,
|
utils.MinerGasTargetFlag,
|
||||||
utils.GasPriceFlag,
|
utils.MinerEtherbaseFlag,
|
||||||
utils.ExtraDataFlag,
|
utils.MinerExtraDataFlag,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -231,8 +231,11 @@ var AppHelpFlagGroups = []flagGroup{
|
|||||||
{
|
{
|
||||||
Name: "DEPRECATED",
|
Name: "DEPRECATED",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
utils.FastSyncFlag,
|
utils.MinerLegacyThreadsFlag,
|
||||||
utils.LightModeFlag,
|
utils.MinerLegacyGasTargetFlag,
|
||||||
|
utils.MinerLegacyGasPriceFlag,
|
||||||
|
utils.MinerLegacyEtherbaseFlag,
|
||||||
|
utils.MinerLegacyExtraDataFlag,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ ADD genesis.json /genesis.json
|
|||||||
RUN \
|
RUN \
|
||||||
echo 'geth --cache 512 init /genesis.json' > geth.sh && \{{if .Unlock}}
|
echo 'geth --cache 512 init /genesis.json' > geth.sh && \{{if .Unlock}}
|
||||||
echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}}
|
echo 'mkdir -p /root/.ethereum/keystore/ && cp /signer.json /root/.ethereum/keystore/' >> geth.sh && \{{end}}
|
||||||
echo $'exec geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--etherbase {{.Etherbase}} --mine --minerthreads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --targetgaslimit {{.GasTarget}} --gasprice {{.GasPrice}}' >> geth.sh
|
echo $'exec geth --networkid {{.NetworkID}} --cache 512 --port {{.Port}} --maxpeers {{.Peers}} {{.LightFlag}} --ethstats \'{{.Ethstats}}\' {{if .Bootnodes}}--bootnodes {{.Bootnodes}}{{end}} {{if .Etherbase}}--miner.etherbase {{.Etherbase}} --mine --miner.threads 1{{end}} {{if .Unlock}}--unlock 0 --password /signer.pass --mine{{end}} --miner.gastarget {{.GasTarget}} --miner.gasprice {{.GasPrice}}' >> geth.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh", "geth.sh"]
|
ENTRYPOINT ["/bin/sh", "geth.sh"]
|
||||||
`
|
`
|
||||||
|
@ -157,14 +157,6 @@ var (
|
|||||||
Usage: "Document Root for HTTPClient file scheme",
|
Usage: "Document Root for HTTPClient file scheme",
|
||||||
Value: DirectoryString{homeDir()},
|
Value: DirectoryString{homeDir()},
|
||||||
}
|
}
|
||||||
FastSyncFlag = cli.BoolFlag{
|
|
||||||
Name: "fast",
|
|
||||||
Usage: "Enable fast syncing through state downloads (replaced by --syncmode)",
|
|
||||||
}
|
|
||||||
LightModeFlag = cli.BoolFlag{
|
|
||||||
Name: "light",
|
|
||||||
Usage: "Enable light client mode (replaced by --syncmode)",
|
|
||||||
}
|
|
||||||
defaultSyncMode = eth.DefaultConfig.SyncMode
|
defaultSyncMode = eth.DefaultConfig.SyncMode
|
||||||
SyncModeFlag = TextMarshalerFlag{
|
SyncModeFlag = TextMarshalerFlag{
|
||||||
Name: "syncmode",
|
Name: "syncmode",
|
||||||
@ -321,29 +313,53 @@ var (
|
|||||||
Usage: "Number of CPU threads to use for mining",
|
Usage: "Number of CPU threads to use for mining",
|
||||||
Value: 0,
|
Value: 0,
|
||||||
}
|
}
|
||||||
|
MinerLegacyThreadsFlag = cli.IntFlag{
|
||||||
|
Name: "minerthreads",
|
||||||
|
Usage: "Number of CPU threads to use for mining (deprecated, use --miner.threads)",
|
||||||
|
Value: 0,
|
||||||
|
}
|
||||||
MinerNotifyFlag = cli.StringFlag{
|
MinerNotifyFlag = cli.StringFlag{
|
||||||
Name: "miner.notify",
|
Name: "miner.notify",
|
||||||
Usage: "Comma separated HTTP URL list to notify of new work packages",
|
Usage: "Comma separated HTTP URL list to notify of new work packages",
|
||||||
}
|
}
|
||||||
TargetGasLimitFlag = cli.Uint64Flag{
|
MinerGasTargetFlag = cli.Uint64Flag{
|
||||||
Name: "targetgaslimit",
|
Name: "miner.gastarget",
|
||||||
Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine",
|
Usage: "Target gas floor for mined blocks",
|
||||||
Value: params.GenesisGasLimit,
|
Value: params.GenesisGasLimit,
|
||||||
}
|
}
|
||||||
EtherbaseFlag = cli.StringFlag{
|
MinerLegacyGasTargetFlag = cli.Uint64Flag{
|
||||||
Name: "etherbase",
|
Name: "targetgaslimit",
|
||||||
Usage: "Public address for block mining rewards (default = first account created)",
|
Usage: "Target gas floor for mined blocks (deprecated, use --miner.gastarget)",
|
||||||
Value: "0",
|
Value: params.GenesisGasLimit,
|
||||||
}
|
}
|
||||||
GasPriceFlag = BigFlag{
|
MinerGasPriceFlag = BigFlag{
|
||||||
Name: "gasprice",
|
Name: "miner.gasprice",
|
||||||
Usage: "Minimal gas price to accept for mining a transactions",
|
Usage: "Minimal gas price for mining a transactions",
|
||||||
Value: eth.DefaultConfig.GasPrice,
|
Value: eth.DefaultConfig.GasPrice,
|
||||||
}
|
}
|
||||||
ExtraDataFlag = cli.StringFlag{
|
MinerLegacyGasPriceFlag = BigFlag{
|
||||||
Name: "extradata",
|
Name: "gasprice",
|
||||||
|
Usage: "Minimal gas price for mining a transactions (deprecated, use --miner.gasprice)",
|
||||||
|
Value: eth.DefaultConfig.GasPrice,
|
||||||
|
}
|
||||||
|
MinerEtherbaseFlag = cli.StringFlag{
|
||||||
|
Name: "miner.etherbase",
|
||||||
|
Usage: "Public address for block mining rewards (default = first account)",
|
||||||
|
Value: "0",
|
||||||
|
}
|
||||||
|
MinerLegacyEtherbaseFlag = cli.StringFlag{
|
||||||
|
Name: "etherbase",
|
||||||
|
Usage: "Public address for block mining rewards (default = first account, deprecated, use --miner.etherbase)",
|
||||||
|
Value: "0",
|
||||||
|
}
|
||||||
|
MinerExtraDataFlag = cli.StringFlag{
|
||||||
|
Name: "miner.extradata",
|
||||||
Usage: "Block extra data set by the miner (default = client version)",
|
Usage: "Block extra data set by the miner (default = client version)",
|
||||||
}
|
}
|
||||||
|
MinerLegacyExtraDataFlag = cli.StringFlag{
|
||||||
|
Name: "extradata",
|
||||||
|
Usage: "Block extra data set by the miner (default = client version, deprecated, use --miner.extradata)",
|
||||||
|
}
|
||||||
// Account settings
|
// Account settings
|
||||||
UnlockedAccountFlag = cli.StringFlag{
|
UnlockedAccountFlag = cli.StringFlag{
|
||||||
Name: "unlock",
|
Name: "unlock",
|
||||||
@ -813,10 +829,19 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
|
|||||||
// setEtherbase retrieves the etherbase either from the directly specified
|
// setEtherbase retrieves the etherbase either from the directly specified
|
||||||
// command line flags or from the keystore if CLI indexed.
|
// command line flags or from the keystore if CLI indexed.
|
||||||
func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) {
|
func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *eth.Config) {
|
||||||
if ctx.GlobalIsSet(EtherbaseFlag.Name) {
|
// Extract the current etherbase, new flag overriding legacy one
|
||||||
account, err := MakeAddress(ks, ctx.GlobalString(EtherbaseFlag.Name))
|
var etherbase string
|
||||||
|
if ctx.GlobalIsSet(MinerLegacyEtherbaseFlag.Name) {
|
||||||
|
etherbase = ctx.GlobalString(MinerLegacyEtherbaseFlag.Name)
|
||||||
|
}
|
||||||
|
if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
|
||||||
|
etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name)
|
||||||
|
}
|
||||||
|
// Convert the etherbase into an address and configure it
|
||||||
|
if etherbase != "" {
|
||||||
|
account, err := MakeAddress(ks, etherbase)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Option %q: %v", EtherbaseFlag.Name, err)
|
Fatalf("Invalid miner etherbase: %v", err)
|
||||||
}
|
}
|
||||||
cfg.Etherbase = account.Address
|
cfg.Etherbase = account.Address
|
||||||
}
|
}
|
||||||
@ -847,7 +872,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
|
|||||||
setBootstrapNodes(ctx, cfg)
|
setBootstrapNodes(ctx, cfg)
|
||||||
setBootstrapNodesV5(ctx, cfg)
|
setBootstrapNodesV5(ctx, cfg)
|
||||||
|
|
||||||
lightClient := ctx.GlobalBool(LightModeFlag.Name) || ctx.GlobalString(SyncModeFlag.Name) == "light"
|
lightClient := ctx.GlobalString(SyncModeFlag.Name) == "light"
|
||||||
lightServer := ctx.GlobalInt(LightServFlag.Name) != 0
|
lightServer := ctx.GlobalInt(LightServFlag.Name) != 0
|
||||||
lightPeers := ctx.GlobalInt(LightPeersFlag.Name)
|
lightPeers := ctx.GlobalInt(LightPeersFlag.Name)
|
||||||
|
|
||||||
@ -1052,8 +1077,6 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
|
|||||||
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
||||||
// Avoid conflicting network flags
|
// Avoid conflicting network flags
|
||||||
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag)
|
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag)
|
||||||
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
|
|
||||||
checkExclusive(ctx, LightServFlag, LightModeFlag)
|
|
||||||
checkExclusive(ctx, LightServFlag, SyncModeFlag, "light")
|
checkExclusive(ctx, LightServFlag, SyncModeFlag, "light")
|
||||||
|
|
||||||
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
|
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
|
||||||
@ -1062,13 +1085,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
|||||||
setTxPool(ctx, &cfg.TxPool)
|
setTxPool(ctx, &cfg.TxPool)
|
||||||
setEthash(ctx, cfg)
|
setEthash(ctx, cfg)
|
||||||
|
|
||||||
switch {
|
if ctx.GlobalIsSet(SyncModeFlag.Name) {
|
||||||
case ctx.GlobalIsSet(SyncModeFlag.Name):
|
|
||||||
cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode)
|
cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode)
|
||||||
case ctx.GlobalBool(FastSyncFlag.Name):
|
|
||||||
cfg.SyncMode = downloader.FastSync
|
|
||||||
case ctx.GlobalBool(LightModeFlag.Name):
|
|
||||||
cfg.SyncMode = downloader.LightSync
|
|
||||||
}
|
}
|
||||||
if ctx.GlobalIsSet(LightServFlag.Name) {
|
if ctx.GlobalIsSet(LightServFlag.Name) {
|
||||||
cfg.LightServ = ctx.GlobalInt(LightServFlag.Name)
|
cfg.LightServ = ctx.GlobalInt(LightServFlag.Name)
|
||||||
@ -1093,6 +1111,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
|||||||
if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {
|
if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {
|
||||||
cfg.TrieCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
|
cfg.TrieCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
|
||||||
}
|
}
|
||||||
|
if ctx.GlobalIsSet(MinerLegacyThreadsFlag.Name) {
|
||||||
|
cfg.MinerThreads = ctx.GlobalInt(MinerLegacyThreadsFlag.Name)
|
||||||
|
}
|
||||||
if ctx.GlobalIsSet(MinerThreadsFlag.Name) {
|
if ctx.GlobalIsSet(MinerThreadsFlag.Name) {
|
||||||
cfg.MinerThreads = ctx.GlobalInt(MinerThreadsFlag.Name)
|
cfg.MinerThreads = ctx.GlobalInt(MinerThreadsFlag.Name)
|
||||||
}
|
}
|
||||||
@ -1102,11 +1123,17 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
|||||||
if ctx.GlobalIsSet(DocRootFlag.Name) {
|
if ctx.GlobalIsSet(DocRootFlag.Name) {
|
||||||
cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name)
|
cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name)
|
||||||
}
|
}
|
||||||
if ctx.GlobalIsSet(ExtraDataFlag.Name) {
|
if ctx.GlobalIsSet(MinerLegacyExtraDataFlag.Name) {
|
||||||
cfg.ExtraData = []byte(ctx.GlobalString(ExtraDataFlag.Name))
|
cfg.ExtraData = []byte(ctx.GlobalString(MinerLegacyExtraDataFlag.Name))
|
||||||
}
|
}
|
||||||
if ctx.GlobalIsSet(GasPriceFlag.Name) {
|
if ctx.GlobalIsSet(MinerExtraDataFlag.Name) {
|
||||||
cfg.GasPrice = GlobalBig(ctx, GasPriceFlag.Name)
|
cfg.ExtraData = []byte(ctx.GlobalString(MinerExtraDataFlag.Name))
|
||||||
|
}
|
||||||
|
if ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) {
|
||||||
|
cfg.GasPrice = GlobalBig(ctx, MinerLegacyGasPriceFlag.Name)
|
||||||
|
}
|
||||||
|
if ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
|
||||||
|
cfg.GasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name)
|
||||||
}
|
}
|
||||||
if ctx.GlobalIsSet(VMEnableDebugFlag.Name) {
|
if ctx.GlobalIsSet(VMEnableDebugFlag.Name) {
|
||||||
// TODO(fjl): force-enable this in --dev mode
|
// TODO(fjl): force-enable this in --dev mode
|
||||||
@ -1148,7 +1175,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
|
|||||||
log.Info("Using developer account", "address", developer.Address)
|
log.Info("Using developer account", "address", developer.Address)
|
||||||
|
|
||||||
cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address)
|
cfg.Genesis = core.DeveloperGenesisBlock(uint64(ctx.GlobalInt(DeveloperPeriodFlag.Name)), developer.Address)
|
||||||
if !ctx.GlobalIsSet(GasPriceFlag.Name) {
|
if !ctx.GlobalIsSet(MinerGasPriceFlag.Name) && !ctx.GlobalIsSet(MinerLegacyGasPriceFlag.Name) {
|
||||||
cfg.GasPrice = big.NewInt(1)
|
cfg.GasPrice = big.NewInt(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1223,7 +1250,10 @@ func RegisterEthStatsService(stack *node.Node, url string) {
|
|||||||
// SetupNetwork configures the system for either the main net or some test network.
|
// SetupNetwork configures the system for either the main net or some test network.
|
||||||
func SetupNetwork(ctx *cli.Context) {
|
func SetupNetwork(ctx *cli.Context) {
|
||||||
// TODO(fjl): move target gas limit into config
|
// TODO(fjl): move target gas limit into config
|
||||||
params.TargetGasLimit = ctx.GlobalUint64(TargetGasLimitFlag.Name)
|
params.TargetGasLimit = ctx.GlobalUint64(MinerLegacyGasTargetFlag.Name)
|
||||||
|
if ctx.GlobalIsSet(MinerGasTargetFlag.Name) {
|
||||||
|
params.TargetGasLimit = ctx.GlobalUint64(MinerGasTargetFlag.Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetupMetrics(ctx *cli.Context) {
|
func SetupMetrics(ctx *cli.Context) {
|
||||||
@ -1254,7 +1284,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
|
|||||||
handles = makeDatabaseHandles()
|
handles = makeDatabaseHandles()
|
||||||
)
|
)
|
||||||
name := "chaindata"
|
name := "chaindata"
|
||||||
if ctx.GlobalBool(LightModeFlag.Name) {
|
if ctx.GlobalString(SyncModeFlag.Name) == "light" {
|
||||||
name = "lightchaindata"
|
name = "lightchaindata"
|
||||||
}
|
}
|
||||||
chainDb, err := stack.OpenDatabase(name, cache, handles)
|
chainDb, err := stack.OpenDatabase(name, cache, handles)
|
||||||
|
Loading…
Reference in New Issue
Block a user