go-ethereum/miner/gen_miner.go
YaoZengzeng 8f453de0fc eth,miner: encapsulate the mining-related options of eth config
Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
2018-08-26 20:22:05 +08:00

62 lines
1.4 KiB
Go

// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
package miner
import (
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
)
var _ = (*configMarshaling)(nil)
// MarshalTOML marshals as TOML.
func (c Config) MarshalTOML() (interface{}, error) {
type Config struct {
Etherbase common.Address `toml:",omitempty"`
Notify []string `toml:",omitempty"`
ExtraData hexutil.Bytes `toml:",omitempty"`
GasPrice *big.Int
Recommit time.Duration
}
var enc Config
enc.Etherbase = c.Etherbase
enc.Notify = c.Notify
enc.ExtraData = c.ExtraData
enc.GasPrice = c.GasPrice
enc.Recommit = c.Recommit
return &enc, nil
}
// UnmarshalTOML unmarshals from TOML.
func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
type Config struct {
Etherbase *common.Address `toml:",omitempty"`
Notify []string `toml:",omitempty"`
ExtraData *hexutil.Bytes `toml:",omitempty"`
GasPrice *big.Int
Recommit *time.Duration
}
var dec Config
if err := unmarshal(&dec); err != nil {
return err
}
if dec.Etherbase != nil {
c.Etherbase = *dec.Etherbase
}
if dec.Notify != nil {
c.Notify = dec.Notify
}
if dec.ExtraData != nil {
c.ExtraData = *dec.ExtraData
}
if dec.GasPrice != nil {
c.GasPrice = dec.GasPrice
}
if dec.Recommit != nil {
c.Recommit = *dec.Recommit
}
return nil
}