miner: polish miner configuration (#19480)

* cmd, eth, miner: disable advance sealing if user require

* cmd, console, miner, les, eth: wrap the miner config

* eth: remove todo

* cmd, miner: revert noadvance flag

The reason for this is: if the transaction execution is even longer
than block time, then this kind of transactions is DoS attack.
This commit is contained in:
gary rong
2019-04-23 15:08:51 +08:00
committed by Péter Szilágyi
parent d9403690ec
commit 6269e5574c
11 changed files with 162 additions and 162 deletions

View File

@ -25,11 +25,11 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/params"
)
@ -49,11 +49,12 @@ var DefaultConfig = Config{
TrieCleanCache: 256,
TrieDirtyCache: 256,
TrieTimeout: 60 * time.Minute,
MinerGasFloor: 8000000,
MinerGasCeil: 8000000,
MinerGasPrice: big.NewInt(params.GWei),
MinerRecommit: 3 * time.Second,
Miner: miner.Config{
GasFloor: 8000000,
GasCeil: 8000000,
GasPrice: big.NewInt(params.GWei),
Recommit: 3 * time.Second,
},
TxPool: core.DefaultTxPoolConfig,
GPO: gasprice.Config{
Blocks: 20,
@ -82,7 +83,7 @@ func init() {
}
}
//go:generate gencodec -type Config -field-override configMarshaling -formats toml -out gen_config.go
//go:generate gencodec -type Config -formats toml -out gen_config.go
type Config struct {
// The genesis block, which is inserted if the database is empty.
@ -118,15 +119,8 @@ type Config struct {
TrieDirtyCache int
TrieTimeout time.Duration
// Mining-related options
Etherbase common.Address `toml:",omitempty"`
MinerNotify []string `toml:",omitempty"`
MinerExtraData []byte `toml:",omitempty"`
MinerGasFloor uint64
MinerGasCeil uint64
MinerGasPrice *big.Int
MinerRecommit time.Duration
MinerNoverify bool
// Mining options
Miner miner.Config
// Ethash options
Ethash ethash.Config
@ -155,7 +149,3 @@ type Config struct {
// RPCGasCap is the global gas cap for eth-call variants.
RPCGasCap *big.Int `toml:",omitempty"`
}
type configMarshaling struct {
MinerExtraData hexutil.Bytes
}