Skip to content

eth/ethconfig/config.go

Type MOD
Upstream Lines 234
Changed +32 -0

Add the Ethash config field plus the MESSForceEnable/MESSForceDisable runtime override flags

diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go
index b51b78e19..d7a7386bf 100644
--- a/eth/ethconfig/config.go
+++ b/eth/ethconfig/config.go
@@ -25,6 +25,7 @@ import (
    "github.com/ethereum/go-ethereum/consensus"
    "github.com/ethereum/go-ethereum/consensus/beacon"
    "github.com/ethereum/go-ethereum/consensus/clique"
+   "github.com/ethereum/go-ethereum/consensus/etc"
    "github.com/ethereum/go-ethereum/consensus/ethash"
    "github.com/ethereum/go-ethereum/core"
    "github.com/ethereum/go-ethereum/core/history"
@@ -216,12 +217,43 @@ type Config struct {

    // RangeLimit restricts the maximum range (end - start) for range queries.
    RangeLimit uint64 `toml:",omitempty"`
+
+   MESSForceEnable  bool // Force enable MESS (emergency override)
+   MESSForceDisable bool // Force disable MESS (never enable)
+
+   // Ethash configuration for ETC PoW mining
+   Ethash ethash.Config
 }

 // CreateConsensusEngine creates a consensus engine for the given chain config.
 // Clique is allowed for now to live standalone, but ethash is forbidden and can
 // only exist on already merged networks.
+// ETC chains use the ETCEngine which wraps ethash with ETC-specific rules.
 func CreateConsensusEngine(config *params.ChainConfig, db ethdb.Database) (consensus.Engine, error) {
+   return CreateConsensusEngineWithConfig(config, db, ethash.Config{}, nil, false)
+}
+
+// CreateConsensusEngineWithConfig creates a consensus engine with explicit ethash configuration.
+// This is used for ETC chains that need full PoW support with custom cache/dataset directories.
+// notify URLs and noverify control the remote-sealer plumbing inside ethash;
+// they originate from --miner.notify / --miner.noverify.
+func CreateConsensusEngineWithConfig(config *params.ChainConfig, db ethdb.Database, ethashConfig ethash.Config, notify []string, noverify bool) (consensus.Engine, error) {
+   // ETC Classic chains: use ETCEngine with ETC-specific rules (ECIP-1017, etc.)
+   if config.IsClassic() {
+       if ethashConfig.PowMode == ethash.ModeNormal || ethashConfig.PowMode == ethash.ModeShared {
+           return etc.New(config, ethashConfig, notify, noverify), nil
+       }
+       return etc.NewFaker(config), nil
+   }
+   // Other PoW chains (e.g. test chains): use standard ethash
+   if config.IsPow() {
+       if ethashConfig.PowMode == ethash.ModeNormal || ethashConfig.PowMode == ethash.ModeShared {
+           return ethash.New(ethashConfig, notify, noverify), nil
+       }
+       return ethash.NewFaker(), nil
+   }
+
+   // ETH chains: require TerminalTotalDifficulty for PoS
    if config.TerminalTotalDifficulty == nil {
        log.Error("Geth only supports PoS networks. Please transition legacy networks using Geth v1.13.x.")
        return nil, errors.New("'terminalTotalDifficulty' is not set in genesis block")

← Back to Eth Service