aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-08-13 22:03:16 +0800
committerGitHub <noreply@github.com>2018-08-13 22:03:16 +0800
commitd8328a96b4943798f9dd2a8ae1c787f7e78ff8e4 (patch)
tree8caca301cbd28fa62fbd45ee47dced38f2acd57b /eth
parentfb368723acf83e64c71e1eaa403e7cda06e6ce5e (diff)
parentf0998415ba9a73f0add32f9b5aed2aec98b9a7f3 (diff)
downloaddexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.tar
dexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.tar.gz
dexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.tar.bz2
dexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.tar.lz
dexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.tar.xz
dexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.tar.zst
dexon-d8328a96b4943798f9dd2a8ae1c787f7e78ff8e4.zip
Merge pull request #17347 from karalabe/miner-notify
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