aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-08-08 17:15:08 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-10 14:06:59 +0800
commitf0998415ba9a73f0add32f9b5aed2aec98b9a7f3 (patch)
treef85ad72f6213fc953b3174378d7c7443cc1d1dd5 /eth
parent00e6da9704b2cd7ddcc1cd31ed3f6bbaa8e1e284 (diff)
downloaddexon-f0998415ba9a73f0add32f9b5aed2aec98b9a7f3.tar.gz
dexon-f0998415ba9a73f0add32f9b5aed2aec98b9a7f3.tar.zst
dexon-f0998415ba9a73f0add32f9b5aed2aec98b9a7f3.zip
cmd, consensus/ethash, eth: miner push notifications
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go8
-rw-r--r--eth/config.go1
2 files changed, 5 insertions, 4 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 32946a0ab..865534b19 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -124,7 +124,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
chainConfig: chainConfig,
eventMux: ctx.EventMux,
accountManager: ctx.AccountManager,
- engine: CreateConsensusEngine(ctx, &config.Ethash, chainConfig, chainDb),
+ engine: CreateConsensusEngine(ctx, chainConfig, &config.Ethash, config.MinerNotify, chainDb),
shutdownChan: make(chan bool),
networkID: config.NetworkId,
gasPrice: config.GasPrice,
@@ -210,7 +210,7 @@ func CreateDB(ctx *node.ServiceContext, config *Config, name string) (ethdb.Data
}
// CreateConsensusEngine creates the required type of consensus engine instance for an Ethereum service
-func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chainConfig *params.ChainConfig, db ethdb.Database) consensus.Engine {
+func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, db ethdb.Database) consensus.Engine {
// If proof-of-authority is requested, set it up
if chainConfig.Clique != nil {
return clique.New(chainConfig.Clique, db)
@@ -222,7 +222,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chai
return ethash.NewFaker()
case ethash.ModeTest:
log.Warn("Ethash used in test mode")
- return ethash.NewTester()
+ return ethash.NewTester(nil)
case ethash.ModeShared:
log.Warn("Ethash used in shared mode")
return ethash.NewShared()
@@ -234,7 +234,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chai
DatasetDir: config.DatasetDir,
DatasetsInMem: config.DatasetsInMem,
DatasetsOnDisk: config.DatasetsOnDisk,
- })
+ }, notify)
engine.SetThreads(-1) // Disable CPU mining
return engine
}
diff --git a/eth/config.go b/eth/config.go
index 426d2bf1e..0c82f2923 100644
--- a/eth/config.go
+++ b/eth/config.go
@@ -97,6 +97,7 @@ type Config struct {
// Mining-related options
Etherbase common.Address `toml:",omitempty"`
MinerThreads int `toml:",omitempty"`
+ MinerNotify []string `toml:",omitempty"`
ExtraData []byte `toml:",omitempty"`
GasPrice *big.Int