Skip to content

eth/ethconfig/config.go — Version Comparison

v1.16.8 v1.17.3
Branch etc/v1.16.8-full-node etc/v1.17.3-full-node
Delta +30 -0 +32 -0
ETC delta on v1.16.8 (+30 -0)
diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go
index c4a0956b3..ca95ba29e 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"
@@ -189,12 +190,41 @@ type Config struct {
    // EIP-7966: eth_sendRawTransactionSync timeouts
    TxSyncDefaultTimeout time.Duration `toml:",omitempty"`
    TxSyncMaxTimeout     time.Duration `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{})
+}
+
+// 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.
+func CreateConsensusEngineWithConfig(config *params.ChainConfig, db ethdb.Database, ethashConfig ethash.Config) (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), 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, nil, false), 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")
ETC delta on v1.17.3 (+32 -0)
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 Version Comparison