@ -7,15 +7,13 @@ 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"
)
var _ = ( * configMarshaling ) ( nil )
// MarshalTOML marshals as TOML.
func ( c Config ) MarshalTOML ( ) ( interface { } , error ) {
type Config struct {
@ -23,10 +21,12 @@ func (c Config) MarshalTOML() (interface{}, error) {
NetworkId uint64
SyncMode downloader . SyncMode
NoPruning bool
LightServ int ` toml:",omitempty" `
LightBandwidthIn int ` toml:",omitempty" `
LightBandwidthOut int ` toml:",omitempty" `
LightPeers int ` toml:",omitempty" `
NoPrefetch bool
Whitelist map [ uint64 ] common . Hash ` toml:"-" `
LightServ int ` toml:",omitempty" `
LightBandwidthIn int ` toml:",omitempty" `
LightBandwidthOut int ` toml:",omitempty" `
LightPeers int ` toml:",omitempty" `
OnlyAnnounce bool
ULC * ULCConfig ` toml:",omitempty" `
SkipBcVersionCheck bool ` toml:"-" `
@ -35,14 +35,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
TrieCleanCache int
TrieDirtyCache int
TrieTimeout time . Duration
Etherbase common . Address ` toml:",omitempty" `
MinerNotify [ ] string ` toml:",omitempty" `
MinerExtraData hexutil . Bytes ` toml:",omitempty" `
MinerGasFloor uint64
MinerGasCeil uint64
MinerGasPrice * big . Int
MinerRecommit time . Duration
MinerNoverify bool
Miner miner . Config
Ethash ethash . Config
TxPool core . TxPoolConfig
GPO gasprice . Config
@ -50,12 +43,16 @@ func (c Config) MarshalTOML() (interface{}, error) {
DocRoot string ` toml:"-" `
EWASMInterpreter string
EVMInterpreter string
ConstantinopleOverride * big . Int
RPCGasCap * big . Int ` toml:",omitempty" `
}
var enc Config
enc . Genesis = c . Genesis
enc . NetworkId = c . NetworkId
enc . SyncMode = c . SyncMode
enc . NoPruning = c . NoPruning
enc . NoPrefetch = c . NoPrefetch
enc . Whitelist = c . Whitelist
enc . LightServ = c . LightServ
enc . LightBandwidthIn = c . LightBandwidthIn
enc . LightBandwidthOut = c . LightBandwidthOut
@ -68,22 +65,16 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc . TrieCleanCache = c . TrieCleanCache
enc . TrieDirtyCache = c . TrieDirtyCache
enc . TrieTimeout = c . TrieTimeout
enc . Etherbase = c . Etherbase
enc . MinerNotify = c . MinerNotify
enc . MinerExtraData = c . MinerExtraData
enc . MinerGasFloor = c . MinerGasFloor
enc . MinerGasCeil = c . MinerGasCeil
enc . MinerGasPrice = c . MinerGasPrice
enc . MinerRecommit = c . MinerRecommit
enc . MinerNoverify = c . MinerNoverify
enc . Miner = c . Miner
enc . Ethash = c . Ethash
enc . TxPool = c . TxPool
enc . GPO = c . GPO
enc . EnablePreimageRecording = c . EnablePreimageRecording
enc . DocRoot = c . DocRoot
enc . EWASMInterpreter = c . EWASMInterpreter
enc . EVMInterpreter = c . EVMInterpreter
enc . ConstantinopleOverride = c . ConstantinopleOverride
enc . RPCGasCap = c . RPCGasCap
return & enc , nil
}
@ -94,10 +85,12 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
NetworkId * uint64
SyncMode * downloader . SyncMode
NoPruning * bool
LightServ * int ` toml:",omitempty" `
LightBandwidthIn * int ` toml:",omitempty" `
LightBandwidthOut * int ` toml:",omitempty" `
LightPeers * int ` toml:",omitempty" `
NoPrefetch * bool
Whitelist map [ uint64 ] common . Hash ` toml:"-" `
LightServ * int ` toml:",omitempty" `
LightBandwidthIn * int ` toml:",omitempty" `
LightBandwidthOut * int ` toml:",omitempty" `
LightPeers * int ` toml:",omitempty" `
OnlyAnnounce * bool
ULC * ULCConfig ` toml:",omitempty" `
SkipBcVersionCheck * bool ` toml:"-" `
@ -106,14 +99,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
TrieCleanCache * int
TrieDirtyCache * int
TrieTimeout * time . Duration
Etherbase * common . Address ` toml:",omitempty" `
MinerNotify [ ] string ` toml:",omitempty" `
MinerExtraData * hexutil . Bytes ` toml:",omitempty" `
MinerGasFloor * uint64
MinerGasCeil * uint64
MinerGasPrice * big . Int
MinerRecommit * time . Duration
MinerNoverify * bool
Miner * miner . Config
Ethash * ethash . Config
TxPool * core . TxPoolConfig
GPO * gasprice . Config
@ -121,6 +107,8 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
DocRoot * string ` toml:"-" `
EWASMInterpreter * string
EVMInterpreter * string
ConstantinopleOverride * big . Int
RPCGasCap * big . Int ` toml:",omitempty" `
}
var dec Config
if err := unmarshal ( & dec ) ; err != nil {
@ -138,6 +126,12 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec . NoPruning != nil {
c . NoPruning = * dec . NoPruning
}
if dec . NoPrefetch != nil {
c . NoPrefetch = * dec . NoPrefetch
}
if dec . Whitelist != nil {
c . Whitelist = dec . Whitelist
}
if dec . LightServ != nil {
c . LightServ = * dec . LightServ
}
@ -174,29 +168,8 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec . TrieTimeout != nil {
c . TrieTimeout = * dec . TrieTimeout
}
if dec . Etherbase != nil {
c . Etherbase = * dec . Etherbase
}
if dec . MinerNotify != nil {
c . MinerNotify = dec . MinerNotify
}
if dec . MinerExtraData != nil {
c . MinerExtraData = * dec . MinerExtraData
}
if dec . MinerGasFloor != nil {
c . MinerGasFloor = * dec . MinerGasFloor
}
if dec . MinerGasCeil != nil {
c . MinerGasCeil = * dec . MinerGasCeil
}
if dec . MinerGasPrice != nil {
c . MinerGasPrice = dec . MinerGasPrice
}
if dec . MinerRecommit != nil {
c . MinerRecommit = * dec . MinerRecommit
}
if dec . MinerNoverify != nil {
c . MinerNoverify = * dec . MinerNoverify
if dec . Miner != nil {
c . Miner = * dec . Miner
}
if dec . Ethash != nil {
c . Ethash = * dec . Ethash
@ -219,5 +192,11 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec . EVMInterpreter != nil {
c . EVMInterpreter = * dec . EVMInterpreter
}
if dec . ConstantinopleOverride != nil {
c . ConstantinopleOverride = dec . ConstantinopleOverride
}
if dec . RPCGasCap != nil {
c . RPCGasCap = dec . RPCGasCap
}
return nil
}