diff --git a/cmd/clef/main.go b/cmd/clef/main.go
index a8876c5a9abfb..1ba5f7e0d0586 100644
--- a/cmd/clef/main.go
+++ b/cmd/clef/main.go
@@ -660,7 +660,7 @@ func signer(c *cli.Context) error {
// persistence requirements.
func DefaultConfigDir() string {
// Try to place the data folder in the user's home dir
- home := utils.HomeDir()
+ home := flags.HomeDir()
if home != "" {
if runtime.GOOS == "darwin" {
return filepath.Join(home, "Library", "Signer")
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index cb0906620ec3c..994b6436ad94d 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -23,7 +23,6 @@ import (
"os"
"github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool"
- "github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/urfave/cli/v2"
)
@@ -65,12 +64,12 @@ var (
Usage: "gas limit for the evm",
Value: 10000000000,
}
- PriceFlag = &utils.BigFlag{
+ PriceFlag = &flags.BigFlag{
Name: "price",
Usage: "price set for the evm",
Value: new(big.Int),
}
- ValueFlag = &utils.BigFlag{
+ ValueFlag = &flags.BigFlag{
Name: "value",
Usage: "value set for the evm",
Value: new(big.Int),
diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go
index 6686e923579b5..756d762b53484 100644
--- a/cmd/evm/runner.go
+++ b/cmd/evm/runner.go
@@ -37,6 +37,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm/runtime"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
+ "github.com/ethereum/go-ethereum/internal/flags"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/urfave/cli/v2"
@@ -205,8 +206,8 @@ func runCmd(ctx *cli.Context) error {
Origin: sender,
State: statedb,
GasLimit: initialGas,
- GasPrice: utils.GlobalBig(ctx, PriceFlag.Name),
- Value: utils.GlobalBig(ctx, ValueFlag.Name),
+ GasPrice: flags.GlobalBig(ctx, PriceFlag.Name),
+ Value: flags.GlobalBig(ctx, ValueFlag.Name),
Difficulty: genesisConfig.Difficulty,
Time: new(big.Int).SetUint64(genesisConfig.Timestamp),
Coinbase: genesisConfig.Coinbase,
diff --git a/cmd/geth/config.go b/cmd/geth/config.go
index 92e515017cf89..2c3e68845fda3 100644
--- a/cmd/geth/config.go
+++ b/cmd/geth/config.go
@@ -161,7 +161,7 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
cfg.Eth.OverrideGrayGlacier = new(big.Int).SetUint64(ctx.Uint64(utils.OverrideGrayGlacierFlag.Name))
}
if ctx.IsSet(utils.OverrideTerminalTotalDifficulty.Name) {
- cfg.Eth.OverrideTerminalTotalDifficulty = utils.GlobalBig(ctx, utils.OverrideTerminalTotalDifficulty.Name)
+ cfg.Eth.OverrideTerminalTotalDifficulty = flags.GlobalBig(ctx, utils.OverrideTerminalTotalDifficulty.Name)
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)
// Warn users to migrate if they have a legacy freezer format.
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index acbda116114d9..414b0593e1d01 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -437,7 +437,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon
utils.Fatalf("Ethereum service not running")
}
// Set the gas price to the limits from the CLI and start mining
- gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
+ gasprice := flags.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
ethBackend.TxPool().SetGasPrice(gasprice)
// start mining
threads := ctx.Int(utils.MinerThreadsFlag.Name)
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index af4785774d986..6feef7b099bf7 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -78,10 +78,10 @@ import (
var (
// General settings
- DataDirFlag = &DirectoryFlag{
+ DataDirFlag = &flags.DirectoryFlag{
Name: "datadir",
Usage: "Data directory for the databases and keystore",
- Value: DirectoryString(node.DefaultDataDir()),
+ Value: flags.DirectoryString(node.DefaultDataDir()),
Category: flags.EthCategory,
}
RemoteDBFlag = &cli.StringFlag{
@@ -89,17 +89,17 @@ var (
Usage: "URL for remote database",
Category: flags.LoggingCategory,
}
- AncientFlag = &DirectoryFlag{
+ AncientFlag = &flags.DirectoryFlag{
Name: "datadir.ancient",
Usage: "Data directory for ancient chain segments (default = inside chaindata)",
Category: flags.EthCategory,
}
- MinFreeDiskSpaceFlag = &DirectoryFlag{
+ MinFreeDiskSpaceFlag = &flags.DirectoryFlag{
Name: "datadir.minfreedisk",
Usage: "Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)",
Category: flags.EthCategory,
}
- KeyStoreDirFlag = &DirectoryFlag{
+ KeyStoreDirFlag = &flags.DirectoryFlag{
Name: "keystore",
Usage: "Directory for the keystore (default = inside the datadir)",
Category: flags.AccountCategory,
@@ -175,10 +175,10 @@ var (
Usage: "Custom node name",
Category: flags.NetworkingCategory,
}
- DocRootFlag = DirectoryFlag{
+ DocRootFlag = &flags.DirectoryFlag{
Name: "docroot",
Usage: "Document Root for HTTPClient file scheme",
- Value: DirectoryString(HomeDir()),
+ Value: flags.DirectoryString(flags.HomeDir()),
Category: flags.APICategory,
}
ExitWhenSyncedFlag = &cli.BoolFlag{
@@ -217,7 +217,7 @@ var (
}
defaultSyncMode = ethconfig.Defaults.SyncMode
- SyncModeFlag = &TextMarshalerFlag{
+ SyncModeFlag = &flags.TextMarshalerFlag{
Name: "syncmode",
Usage: `Blockchain sync mode ("snap", "full" or "light")`,
Value: &defaultSyncMode,
@@ -267,7 +267,7 @@ var (
Usage: "Manually specify Gray Glacier fork-block, overriding the bundled setting",
Category: flags.EthCategory,
}
- OverrideTerminalTotalDifficulty = &BigFlag{
+ OverrideTerminalTotalDifficulty = &flags.BigFlag{
Name: "override.terminaltotaldifficulty",
Usage: "Manually specify TerminalTotalDifficulty, overriding the bundled setting",
Category: flags.EthCategory,
@@ -327,7 +327,7 @@ var (
}
// Ethash settings
- EthashCacheDirFlag = &DirectoryFlag{
+ EthashCacheDirFlag = &flags.DirectoryFlag{
Name: "ethash.cachedir",
Usage: "Directory to store the ethash verification caches (default = inside the datadir)",
Category: flags.EthashCategory,
@@ -349,10 +349,10 @@ var (
Usage: "Lock memory maps of recent ethash caches",
Category: flags.EthashCategory,
}
- EthashDatasetDirFlag = &DirectoryFlag{
+ EthashDatasetDirFlag = &flags.DirectoryFlag{
Name: "ethash.dagdir",
Usage: "Directory to store the ethash mining DAGs",
- Value: DirectoryString(ethconfig.Defaults.Ethash.DatasetDir),
+ Value: flags.DirectoryString(ethconfig.Defaults.Ethash.DatasetDir),
Category: flags.EthashCategory,
}
EthashDatasetsInMemoryFlag = &cli.IntFlag{
@@ -526,7 +526,7 @@ var (
Value: ethconfig.Defaults.Miner.GasCeil,
Category: flags.MinerCategory,
}
- MinerGasPriceFlag = &BigFlag{
+ MinerGasPriceFlag = &flags.BigFlag{
Name: "miner.gasprice",
Usage: "Minimum gas price for mining a transaction",
Value: ethconfig.Defaults.Miner.GasPrice,
@@ -660,7 +660,7 @@ var (
Usage: "Disable the IPC-RPC server",
Category: flags.APICategory,
}
- IPCPathFlag = &DirectoryFlag{
+ IPCPathFlag = &flags.DirectoryFlag{
Name: "ipcpath",
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
Category: flags.APICategory,
@@ -837,10 +837,10 @@ var (
}
// Console
- JSpathFlag = &DirectoryFlag{
+ JSpathFlag = &flags.DirectoryFlag{
Name: "jspath",
Usage: "JavaScript root path for `loadScript`",
- Value: DirectoryString("."),
+ Value: flags.DirectoryString("."),
Category: flags.APICategory,
}
@@ -1632,7 +1632,7 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
cfg.GasCeil = ctx.Uint64(MinerGasLimitFlag.Name)
}
if ctx.IsSet(MinerGasPriceFlag.Name) {
- cfg.GasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name)
+ cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name)
}
if ctx.IsSet(MinerRecommitIntervalFlag.Name) {
cfg.Recommit = ctx.Duration(MinerRecommitIntervalFlag.Name)
@@ -1760,7 +1760,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
godebug.SetGCPercent(int(gogc))
if ctx.IsSet(SyncModeFlag.Name) {
- cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode)
+ cfg.SyncMode = *flags.GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode)
}
if ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name)
diff --git a/cmd/utils/customflags.go b/internal/flags/flags.go
similarity index 93%
rename from cmd/utils/customflags.go
rename to internal/flags/flags.go
index 74d26b63336b5..0ae2c6a512efe 100644
--- a/cmd/utils/customflags.go
+++ b/internal/flags/flags.go
@@ -1,20 +1,20 @@
// Copyright 2015 The go-ethereum Authors
-// This file is part of go-ethereum.
+// This file is part of the go-ethereum library.
//
-// go-ethereum is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
-// go-ethereum is distributed in the hope that it will be useful,
+// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Lesser General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see .
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
-package utils
+package flags
import (
"encoding"
diff --git a/cmd/utils/customflags_test.go b/internal/flags/flags_test.go
similarity index 61%
rename from cmd/utils/customflags_test.go
rename to internal/flags/flags_test.go
index de39ca36a116c..a0d4af7ca3606 100644
--- a/cmd/utils/customflags_test.go
+++ b/internal/flags/flags_test.go
@@ -1,20 +1,20 @@
// Copyright 2015 The go-ethereum Authors
-// This file is part of go-ethereum.
+// This file is part of the go-ethereum library.
//
-// go-ethereum is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// The go-ethereum library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
-// go-ethereum is distributed in the hope that it will be useful,
+// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// GNU Lesser General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see .
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
-package utils
+package flags
import (
"os"