aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-28 21:59:05 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-28 21:59:05 +0800
commitc1c003e4ff36c22d67662ca661fc78cde850d401 (patch)
treeb8bea54350fb6894cfd63ebc87a164acc3fba7e6 /eth
parent63352bf4247f05d8ef255ff8c63290225c3bc671 (diff)
downloaddexon-c1c003e4ff36c22d67662ca661fc78cde850d401.tar
dexon-c1c003e4ff36c22d67662ca661fc78cde850d401.tar.gz
dexon-c1c003e4ff36c22d67662ca661fc78cde850d401.tar.bz2
dexon-c1c003e4ff36c22d67662ca661fc78cde850d401.tar.lz
dexon-c1c003e4ff36c22d67662ca661fc78cde850d401.tar.xz
dexon-c1c003e4ff36c22d67662ca661fc78cde850d401.tar.zst
dexon-c1c003e4ff36c22d67662ca661fc78cde850d401.zip
consensus, miner: stale block mining support (#17506)
* consensus, miner: stale block supporting * consensus, miner: refactor seal signature * cmd, consensus, eth: add miner noverify flag * cmd, consensus, miner: polish
Diffstat (limited to 'eth')
-rw-r--r--eth/api_tracer.go2
-rw-r--r--eth/backend.go8
-rw-r--r--eth/config.go1
-rw-r--r--eth/gen_config.go7
4 files changed, 12 insertions, 6 deletions
diff --git a/eth/api_tracer.go b/eth/api_tracer.go
index 704a6cdba..0a8b9a994 100644
--- a/eth/api_tracer.go
+++ b/eth/api_tracer.go
@@ -294,7 +294,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
failed = err
break
}
- // Reference the trie twice, once for us, once for the trancer
+ // Reference the trie twice, once for us, once for the tracer
database.TrieDB().Reference(root, common.Hash{})
if number >= origin {
database.TrieDB().Reference(root, common.Hash{})
diff --git a/eth/backend.go b/eth/backend.go
index da7e0b2cd..3032e1a6d 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -130,7 +130,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
chainConfig: chainConfig,
eventMux: ctx.EventMux,
accountManager: ctx.AccountManager,
- engine: CreateConsensusEngine(ctx, chainConfig, &config.Ethash, config.MinerNotify, chainDb),
+ engine: CreateConsensusEngine(ctx, chainConfig, &config.Ethash, config.MinerNotify, config.MinerNoverify, chainDb),
shutdownChan: make(chan bool),
networkID: config.NetworkId,
gasPrice: config.MinerGasPrice,
@@ -216,7 +216,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, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, db ethdb.Database) consensus.Engine {
+func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine {
// If proof-of-authority is requested, set it up
if chainConfig.Clique != nil {
return clique.New(chainConfig.Clique, db)
@@ -228,7 +228,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainCo
return ethash.NewFaker()
case ethash.ModeTest:
log.Warn("Ethash used in test mode")
- return ethash.NewTester(nil)
+ return ethash.NewTester(nil, noverify)
case ethash.ModeShared:
log.Warn("Ethash used in shared mode")
return ethash.NewShared()
@@ -240,7 +240,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainCo
DatasetDir: config.DatasetDir,
DatasetsInMem: config.DatasetsInMem,
DatasetsOnDisk: config.DatasetsOnDisk,
- }, notify)
+ }, notify, noverify)
engine.SetThreads(-1) // Disable CPU mining
return engine
}
diff --git a/eth/config.go b/eth/config.go
index 5b2eca585..517d7d8f3 100644
--- a/eth/config.go
+++ b/eth/config.go
@@ -101,6 +101,7 @@ type Config struct {
MinerExtraData []byte `toml:",omitempty"`
MinerGasPrice *big.Int
MinerRecommit time.Duration
+ MinerNoverify bool
// Ethash options
Ethash ethash.Config
diff --git a/eth/gen_config.go b/eth/gen_config.go
index a72e35bcd..df4ffeb11 100644
--- a/eth/gen_config.go
+++ b/eth/gen_config.go
@@ -35,6 +35,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
MinerExtraData hexutil.Bytes `toml:",omitempty"`
MinerGasPrice *big.Int
MinerRecommit time.Duration
+ MinerNoverify bool
Ethash ethash.Config
TxPool core.TxPoolConfig
GPO gasprice.Config
@@ -58,6 +59,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.MinerExtraData = c.MinerExtraData
enc.MinerGasPrice = c.MinerGasPrice
enc.MinerRecommit = c.MinerRecommit
+ enc.MinerNoverify = c.MinerNoverify
enc.Ethash = c.Ethash
enc.TxPool = c.TxPool
enc.GPO = c.GPO
@@ -81,11 +83,11 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
TrieCache *int
TrieTimeout *time.Duration
Etherbase *common.Address `toml:",omitempty"`
- MinerThreads *int `toml:",omitempty"`
MinerNotify []string `toml:",omitempty"`
MinerExtraData *hexutil.Bytes `toml:",omitempty"`
MinerGasPrice *big.Int
MinerRecommit *time.Duration
+ MinerNoverify *bool
Ethash *ethash.Config
TxPool *core.TxPoolConfig
GPO *gasprice.Config
@@ -144,6 +146,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec.MinerRecommit != nil {
c.MinerRecommit = *dec.MinerRecommit
}
+ if dec.MinerNoverify != nil {
+ c.MinerNoverify = *dec.MinerNoverify
+ }
if dec.Ethash != nil {
c.Ethash = *dec.Ethash
}