Skip to content

setEthash

Source (upstream pre-purge) Current
File cmd/utils/flags.go flags_etc.go
Symbol setEthash setEthash
Ref dde2da0ef~1 etc/v1.17.4-full-node

Applies the --ethash.* flags to ethconfig, plus the --fakepow → Ethash.PowMode=ModeFake mapping. CacheDir/DatasetDir handling is delegated to the core-geth helpers setEthashCacheDir/setEthashDatasetDir: on --classic/--mordor the default cache dir becomes "etchash" (inside the datadir) and the default DAG dir the etchash location (~/Library/Etchash, %LOCALAPPDATA%\Etchash or ~/.etchash), so ECIP-1099 60000-block-epoch files never collide with ETH ethash files. An explicit --ethash.cachedir/--ethash.dagdir always wins.

3-way merge — purge → getc ← upstream

pre-purgecore-geth≈ adapted (origin inferred by similarity)fork-only
// setEthash configures the ethash settings from CLI flags.
func setEthash(ctx *cli.Context, cfg *ethconfig.Config) {
// ECIP-1099 directory configuration
setEthashCacheDir(ctx, cfg)
setEthashDatasetDir(ctx, cfg)
if ctx.IsSet(EthashCachesInMemoryFlag.Name) {
cfg.Ethash.CachesInMem = ctx.Int(EthashCachesInMemoryFlag.Name)
}
if ctx.IsSet(EthashCachesOnDiskFlag.Name) {
cfg.Ethash.CachesOnDisk = ctx.Int(EthashCachesOnDiskFlag.Name)
}
if ctx.IsSet(EthashCachesLockMmapFlag.Name) {
cfg.Ethash.CachesLockMmap = ctx.Bool(EthashCachesLockMmapFlag.Name)
}
if ctx.IsSet(EthashDatasetsInMemoryFlag.Name) {
cfg.Ethash.DatasetsInMem = ctx.Int(EthashDatasetsInMemoryFlag.Name)
}
if ctx.IsSet(EthashDatasetsOnDiskFlag.Name) {
cfg.Ethash.DatasetsOnDisk = ctx.Int(EthashDatasetsOnDiskFlag.Name)
}
if ctx.IsSet(EthashDatasetsLockMmapFlag.Name) {
cfg.Ethash.DatasetsLockMmap = ctx.Bool(EthashDatasetsLockMmapFlag.Name)
}
if ctx.Bool(FakePoWFlag.Name) {
cfg.Ethash.PowMode = ethash.ModeFake
}
core-geth validation — +6 -5 | | | |---|---| | File | [`flags.go`](https://github.com/etclabscore/core-geth/blob/v1.12.20/cmd/utils/flags.go) | | Symbol | `setEthash` | | Ref | `v1.12.20` |
--- a/core-geth/cmd/utils/flags.go
+++ b/etc/cmd/utils/flags_etc.go
@@ -1,11 +1,9 @@
-func setEthash(ctx *cli.Context, cfg *eth.Config) {
-   // ECIP-1099
+// setEthash configures the ethash settings from CLI flags.
+func setEthash(ctx *cli.Context, cfg *ethconfig.Config) {
+   // ECIP-1099 directory configuration
    setEthashCacheDir(ctx, cfg)
    setEthashDatasetDir(ctx, cfg)

-   if ctx.Bool(FakePoWPoissonFlag.Name) {
-       cfg.Ethash.PowMode = ethash.ModePoissonFake
-   }
    if ctx.IsSet(EthashCachesInMemoryFlag.Name) {
        cfg.Ethash.CachesInMem = ctx.Int(EthashCachesInMemoryFlag.Name)
    }
@@ -24,4 +22,7 @@
    if ctx.IsSet(EthashDatasetsLockMmapFlag.Name) {
        cfg.Ethash.DatasetsLockMmap = ctx.Bool(EthashDatasetsLockMmapFlag.Name)
    }
+   if ctx.Bool(FakePoWFlag.Name) {
+       cfg.Ethash.PowMode = ethash.ModeFake
+   }
 }

← CLI, Config & Genesis