github.com/gochain-io/gochain/v3@v3.2.8/eth/gen_config.go (about)

     1  // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
     2  
     3  package eth
     4  
     5  import (
     6  	"math/big"
     7  	"time"
     8  
     9  	"github.com/gochain-io/gochain/v3/common"
    10  	"github.com/gochain-io/gochain/v3/common/hexutil"
    11  	"github.com/gochain-io/gochain/v3/core"
    12  	"github.com/gochain-io/gochain/v3/eth/downloader"
    13  	"github.com/gochain-io/gochain/v3/eth/gasprice"
    14  )
    15  
    16  var _ = (*configMarshaling)(nil)
    17  
    18  // MarshalTOML marshals as TOML.
    19  func (c Config) MarshalTOML() (interface{}, error) {
    20  	type Config struct {
    21  		Genesis                 *core.Genesis `toml:",omitempty"`
    22  		NetworkId               uint64
    23  		SyncMode                downloader.SyncMode
    24  		NoPruning               bool
    25  		LightServ               int  `toml:",omitempty"`
    26  		LightPeers              int  `toml:",omitempty"`
    27  		SkipBcVersionCheck      bool `toml:"-"`
    28  		DatabaseHandles         int  `toml:"-"`
    29  		DatabaseCache           int
    30  		TrieCache               int
    31  		TrieTimeout             time.Duration
    32  		Etherbase               common.Address `toml:",omitempty"`
    33  		MinerExtraData          hexutil.Bytes  `toml:",omitempty"`
    34  		MinerGasPrice           *big.Int
    35  		TxPool                  core.TxPoolConfig
    36  		GPO                     gasprice.Config
    37  		EnablePreimageRecording bool
    38  		DocRoot                 string `toml:"-"`
    39  	}
    40  	var enc Config
    41  	enc.Genesis = c.Genesis
    42  	enc.NetworkId = c.NetworkId
    43  	enc.SyncMode = c.SyncMode
    44  	enc.NoPruning = c.NoPruning
    45  	enc.LightServ = c.LightServ
    46  	enc.LightPeers = c.LightPeers
    47  	enc.SkipBcVersionCheck = c.SkipBcVersionCheck
    48  	enc.DatabaseHandles = c.DatabaseHandles
    49  	enc.DatabaseCache = c.DatabaseCache
    50  	enc.TrieCache = c.TrieCache
    51  	enc.TrieTimeout = c.TrieTimeout
    52  	enc.Etherbase = c.Etherbase
    53  	enc.MinerExtraData = c.MinerExtraData
    54  	enc.MinerGasPrice = c.MinerGasPrice
    55  	enc.TxPool = c.TxPool
    56  	enc.GPO = c.GPO
    57  	enc.EnablePreimageRecording = c.EnablePreimageRecording
    58  	enc.DocRoot = c.DocRoot
    59  	// enc.Archive = c.Archive
    60  	return &enc, nil
    61  }
    62  
    63  // UnmarshalTOML unmarshals from TOML.
    64  func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
    65  	type Config struct {
    66  		Genesis                 *core.Genesis `toml:",omitempty"`
    67  		NetworkId               *uint64
    68  		SyncMode                *downloader.SyncMode
    69  		NoPruning               *bool
    70  		LightServ               *int  `toml:",omitempty"`
    71  		LightPeers              *int  `toml:",omitempty"`
    72  		SkipBcVersionCheck      *bool `toml:"-"`
    73  		DatabaseHandles         *int  `toml:"-"`
    74  		DatabaseCache           *int
    75  		TrieCache               *int
    76  		TrieTimeout             *time.Duration
    77  		Etherbase               *common.Address `toml:",omitempty"`
    78  		MinerExtraData          *hexutil.Bytes  `toml:",omitempty"`
    79  		MinerGasPrice           *big.Int
    80  		TxPool                  *core.TxPoolConfig
    81  		GPO                     *gasprice.Config
    82  		EnablePreimageRecording *bool
    83  		DocRoot                 *string `toml:"-"`
    84  		// Archive                 *archive.Config `toml:",omitempty"`
    85  	}
    86  	var dec Config
    87  	if err := unmarshal(&dec); err != nil {
    88  		return err
    89  	}
    90  	if dec.Genesis != nil {
    91  		c.Genesis = dec.Genesis
    92  	}
    93  	if dec.NetworkId != nil {
    94  		c.NetworkId = *dec.NetworkId
    95  	}
    96  	if dec.SyncMode != nil {
    97  		c.SyncMode = *dec.SyncMode
    98  	}
    99  	if dec.NoPruning != nil {
   100  		c.NoPruning = *dec.NoPruning
   101  	}
   102  	if dec.LightServ != nil {
   103  		c.LightServ = *dec.LightServ
   104  	}
   105  	if dec.LightPeers != nil {
   106  		c.LightPeers = *dec.LightPeers
   107  	}
   108  	if dec.SkipBcVersionCheck != nil {
   109  		c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
   110  	}
   111  	if dec.DatabaseHandles != nil {
   112  		c.DatabaseHandles = *dec.DatabaseHandles
   113  	}
   114  	if dec.DatabaseCache != nil {
   115  		c.DatabaseCache = *dec.DatabaseCache
   116  	}
   117  	if dec.TrieCache != nil {
   118  		c.TrieCache = *dec.TrieCache
   119  	}
   120  	if dec.TrieTimeout != nil {
   121  		c.TrieTimeout = *dec.TrieTimeout
   122  	}
   123  	if dec.Etherbase != nil {
   124  		c.Etherbase = *dec.Etherbase
   125  	}
   126  	if dec.MinerExtraData != nil {
   127  		c.MinerExtraData = *dec.MinerExtraData
   128  	}
   129  	if dec.MinerGasPrice != nil {
   130  		c.MinerGasPrice = dec.MinerGasPrice
   131  	}
   132  	if dec.TxPool != nil {
   133  		c.TxPool = *dec.TxPool
   134  	}
   135  	if dec.GPO != nil {
   136  		c.GPO = *dec.GPO
   137  	}
   138  	if dec.EnablePreimageRecording != nil {
   139  		c.EnablePreimageRecording = *dec.EnablePreimageRecording
   140  	}
   141  	if dec.DocRoot != nil {
   142  		c.DocRoot = *dec.DocRoot
   143  	}
   144  	// if dec.Archive != nil {
   145  	// 	c.Archive = *dec.Archive
   146  	// }
   147  	return nil
   148  }