aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2017-11-24 22:10:27 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-11-24 22:10:27 +0800
commitf14047dae57aa69e4fa08d57e19ee9c0283dfa54 (patch)
treeb1b9523a4ce12e2b3cc472bdcf38df7ddbd4bdcc /cmd
parentb0056f5bd096adf42a2c28cd76264f230c7cae20 (diff)
downloaddexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar
dexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.gz
dexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.bz2
dexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.lz
dexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.xz
dexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.tar.zst
dexon-f14047dae57aa69e4fa08d57e19ee9c0283dfa54.zip
cmd, consensus, eth: split ethash related config to it own (#15520)
* cmd, consensus, eth: split ethash related config to it own * eth, consensus: minor polish * eth, consenus, console: compress pow testing config field to single one * consensus, eth: document pow mode
Diffstat (limited to 'cmd')
-rw-r--r--cmd/utils/flags.go34
1 files changed, 19 insertions, 15 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 5c2929268..9fbad8dab 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -217,27 +217,27 @@ var (
EthashCachesInMemoryFlag = cli.IntFlag{
Name: "ethash.cachesinmem",
Usage: "Number of recent ethash caches to keep in memory (16MB each)",
- Value: eth.DefaultConfig.EthashCachesInMem,
+ Value: eth.DefaultConfig.Ethash.CachesInMem,
}
EthashCachesOnDiskFlag = cli.IntFlag{
Name: "ethash.cachesondisk",
Usage: "Number of recent ethash caches to keep on disk (16MB each)",
- Value: eth.DefaultConfig.EthashCachesOnDisk,
+ Value: eth.DefaultConfig.Ethash.CachesOnDisk,
}
EthashDatasetDirFlag = DirectoryFlag{
Name: "ethash.dagdir",
Usage: "Directory to store the ethash mining DAGs (default = inside home folder)",
- Value: DirectoryString{eth.DefaultConfig.EthashDatasetDir},
+ Value: DirectoryString{eth.DefaultConfig.Ethash.DatasetDir},
}
EthashDatasetsInMemoryFlag = cli.IntFlag{
Name: "ethash.dagsinmem",
Usage: "Number of recent ethash mining DAGs to keep in memory (1+GB each)",
- Value: eth.DefaultConfig.EthashDatasetsInMem,
+ Value: eth.DefaultConfig.Ethash.DatasetsInMem,
}
EthashDatasetsOnDiskFlag = cli.IntFlag{
Name: "ethash.dagsondisk",
Usage: "Number of recent ethash mining DAGs to keep on disk (1+GB each)",
- Value: eth.DefaultConfig.EthashDatasetsOnDisk,
+ Value: eth.DefaultConfig.Ethash.DatasetsOnDisk,
}
// Transaction pool settings
TxPoolNoLocalsFlag = cli.BoolFlag{
@@ -910,22 +910,22 @@ func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig) {
func setEthash(ctx *cli.Context, cfg *eth.Config) {
if ctx.GlobalIsSet(EthashCacheDirFlag.Name) {
- cfg.EthashCacheDir = ctx.GlobalString(EthashCacheDirFlag.Name)
+ cfg.Ethash.CacheDir = ctx.GlobalString(EthashCacheDirFlag.Name)
}
if ctx.GlobalIsSet(EthashDatasetDirFlag.Name) {
- cfg.EthashDatasetDir = ctx.GlobalString(EthashDatasetDirFlag.Name)
+ cfg.Ethash.DatasetDir = ctx.GlobalString(EthashDatasetDirFlag.Name)
}
if ctx.GlobalIsSet(EthashCachesInMemoryFlag.Name) {
- cfg.EthashCachesInMem = ctx.GlobalInt(EthashCachesInMemoryFlag.Name)
+ cfg.Ethash.CachesInMem = ctx.GlobalInt(EthashCachesInMemoryFlag.Name)
}
if ctx.GlobalIsSet(EthashCachesOnDiskFlag.Name) {
- cfg.EthashCachesOnDisk = ctx.GlobalInt(EthashCachesOnDiskFlag.Name)
+ cfg.Ethash.CachesOnDisk = ctx.GlobalInt(EthashCachesOnDiskFlag.Name)
}
if ctx.GlobalIsSet(EthashDatasetsInMemoryFlag.Name) {
- cfg.EthashDatasetsInMem = ctx.GlobalInt(EthashDatasetsInMemoryFlag.Name)
+ cfg.Ethash.DatasetsInMem = ctx.GlobalInt(EthashDatasetsInMemoryFlag.Name)
}
if ctx.GlobalIsSet(EthashDatasetsOnDiskFlag.Name) {
- cfg.EthashDatasetsOnDisk = ctx.GlobalInt(EthashDatasetsOnDiskFlag.Name)
+ cfg.Ethash.DatasetsOnDisk = ctx.GlobalInt(EthashDatasetsOnDiskFlag.Name)
}
}
@@ -1159,10 +1159,14 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
} else {
engine = ethash.NewFaker()
if !ctx.GlobalBool(FakePoWFlag.Name) {
- engine = ethash.New(
- stack.ResolvePath(eth.DefaultConfig.EthashCacheDir), eth.DefaultConfig.EthashCachesInMem, eth.DefaultConfig.EthashCachesOnDisk,
- stack.ResolvePath(eth.DefaultConfig.EthashDatasetDir), eth.DefaultConfig.EthashDatasetsInMem, eth.DefaultConfig.EthashDatasetsOnDisk,
- )
+ engine = ethash.New(ethash.Config{
+ CacheDir: stack.ResolvePath(eth.DefaultConfig.Ethash.CacheDir),
+ CachesInMem: eth.DefaultConfig.Ethash.CachesInMem,
+ CachesOnDisk: eth.DefaultConfig.Ethash.CachesOnDisk,
+ DatasetDir: stack.ResolvePath(eth.DefaultConfig.Ethash.DatasetDir),
+ DatasetsInMem: eth.DefaultConfig.Ethash.DatasetsInMem,
+ DatasetsOnDisk: eth.DefaultConfig.Ethash.DatasetsOnDisk,
+ })
}
}
vmcfg := vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)}