github.com/newbtp/btp@v0.0.0-20190709081714-e4aafa07224e/btp/gen_config.go (about)

     1  // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
     2  
     3  package btp
     4  
     5  import (
     6  	"math/big"
     7  	"time"
     8  
     9  	"github.com/btpereum/go-btpereum/common"
    10  	"github.com/btpereum/go-btpereum/consensus/btpash"
    11  	"github.com/btpereum/go-btpereum/core"
    12  	"github.com/btpereum/go-btpereum/btp/downloader"
    13  	"github.com/btpereum/go-btpereum/btp/gasprice"
    14  	"github.com/btpereum/go-btpereum/miner"
    15  	"github.com/btpereum/go-btpereum/params"
    16  )
    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  		NoPrefetch              bool
    26  		Whitelist               map[uint64]common.Hash `toml:"-"`
    27  		LightServ               int                    `toml:",omitempty"`
    28  		LightBandwidthIn        int                    `toml:",omitempty"`
    29  		LightBandwidthOut       int                    `toml:",omitempty"`
    30  		LightPeers              int                    `toml:",omitempty"`
    31  		OnlyAnnounce            bool
    32  		ULC                     *ULCConfig `toml:",omitempty"`
    33  		SkipBcVersionCheck      bool       `toml:"-"`
    34  		DatabaseHandles         int        `toml:"-"`
    35  		DatabaseCache           int
    36  		DatabaseFreezer         string
    37  		TrieCleanCache          int
    38  		TrieDirtyCache          int
    39  		TrieTimeout             time.Duration
    40  		Miner                   miner.Config
    41  		btpash                  btpash.Config
    42  		TxPool                  core.TxPoolConfig
    43  		GPO                     gasprice.Config
    44  		EnablePreimageRecording bool
    45  		DocRoot                 string `toml:"-"`
    46  		EWASMInterpreter        string
    47  		EVMInterpreter          string
    48  		ConstantinopleOverride  *big.Int
    49  		RPCGasCap               *big.Int `toml:",omitempty"`
    50  		Checkpoint              *params.TrustedCheckpoint
    51  		CheckpointOracle        *params.CheckpointOracleConfig
    52  	}
    53  	var enc Config
    54  	enc.Genesis = c.Genesis
    55  	enc.NetworkId = c.NetworkId
    56  	enc.SyncMode = c.SyncMode
    57  	enc.NoPruning = c.NoPruning
    58  	enc.NoPrefetch = c.NoPrefetch
    59  	enc.Whitelist = c.Whitelist
    60  	enc.LightServ = c.LightServ
    61  	enc.LightBandwidthIn = c.LightBandwidthIn
    62  	enc.LightBandwidthOut = c.LightBandwidthOut
    63  	enc.LightPeers = c.LightPeers
    64  	enc.OnlyAnnounce = c.OnlyAnnounce
    65  	enc.ULC = c.ULC
    66  	enc.SkipBcVersionCheck = c.SkipBcVersionCheck
    67  	enc.DatabaseHandles = c.DatabaseHandles
    68  	enc.DatabaseCache = c.DatabaseCache
    69  	enc.DatabaseFreezer = c.DatabaseFreezer
    70  	enc.TrieCleanCache = c.TrieCleanCache
    71  	enc.TrieDirtyCache = c.TrieDirtyCache
    72  	enc.TrieTimeout = c.TrieTimeout
    73  	enc.Miner = c.Miner
    74  	enc.btpash = c.btpash
    75  	enc.TxPool = c.TxPool
    76  	enc.GPO = c.GPO
    77  	enc.EnablePreimageRecording = c.EnablePreimageRecording
    78  	enc.DocRoot = c.DocRoot
    79  	enc.EWASMInterpreter = c.EWASMInterpreter
    80  	enc.EVMInterpreter = c.EVMInterpreter
    81  	enc.RPCGasCap = c.RPCGasCap
    82  	enc.Checkpoint = c.Checkpoint
    83  	enc.CheckpointOracle = c.CheckpointOracle
    84  	return &enc, nil
    85  }
    86  
    87  // UnmarshalTOML unmarshals from TOML.
    88  func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
    89  	type Config struct {
    90  		Genesis                 *core.Genesis `toml:",omitempty"`
    91  		NetworkId               *uint64
    92  		SyncMode                *downloader.SyncMode
    93  		NoPruning               *bool
    94  		NoPrefetch              *bool
    95  		Whitelist               map[uint64]common.Hash `toml:"-"`
    96  		LightServ               *int                   `toml:",omitempty"`
    97  		LightBandwidthIn        *int                   `toml:",omitempty"`
    98  		LightBandwidthOut       *int                   `toml:",omitempty"`
    99  		LightPeers              *int                   `toml:",omitempty"`
   100  		OnlyAnnounce            *bool
   101  		ULC                     *ULCConfig `toml:",omitempty"`
   102  		SkipBcVersionCheck      *bool      `toml:"-"`
   103  		DatabaseHandles         *int       `toml:"-"`
   104  		DatabaseCache           *int
   105  		DatabaseFreezer         *string
   106  		TrieCleanCache          *int
   107  		TrieDirtyCache          *int
   108  		TrieTimeout             *time.Duration
   109  		Miner                   *miner.Config
   110  		btpash                  *btpash.Config
   111  		TxPool                  *core.TxPoolConfig
   112  		GPO                     *gasprice.Config
   113  		EnablePreimageRecording *bool
   114  		DocRoot                 *string `toml:"-"`
   115  		EWASMInterpreter        *string
   116  		EVMInterpreter          *string
   117  		RPCGasCap               *big.Int `toml:",omitempty"`
   118  		Checkpoint              *params.TrustedCheckpoint
   119  		CheckpointOracle        *params.CheckpointOracleConfig
   120  	}
   121  	var dec Config
   122  	if err := unmarshal(&dec); err != nil {
   123  		return err
   124  	}
   125  	if dec.Genesis != nil {
   126  		c.Genesis = dec.Genesis
   127  	}
   128  	if dec.NetworkId != nil {
   129  		c.NetworkId = *dec.NetworkId
   130  	}
   131  	if dec.SyncMode != nil {
   132  		c.SyncMode = *dec.SyncMode
   133  	}
   134  	if dec.NoPruning != nil {
   135  		c.NoPruning = *dec.NoPruning
   136  	}
   137  	if dec.NoPrefetch != nil {
   138  		c.NoPrefetch = *dec.NoPrefetch
   139  	}
   140  	if dec.Whitelist != nil {
   141  		c.Whitelist = dec.Whitelist
   142  	}
   143  	if dec.LightServ != nil {
   144  		c.LightServ = *dec.LightServ
   145  	}
   146  	if dec.LightBandwidthIn != nil {
   147  		c.LightBandwidthIn = *dec.LightBandwidthIn
   148  	}
   149  	if dec.LightBandwidthOut != nil {
   150  		c.LightBandwidthOut = *dec.LightBandwidthOut
   151  	}
   152  	if dec.LightPeers != nil {
   153  		c.LightPeers = *dec.LightPeers
   154  	}
   155  	if dec.OnlyAnnounce != nil {
   156  		c.OnlyAnnounce = *dec.OnlyAnnounce
   157  	}
   158  	if dec.ULC != nil {
   159  		c.ULC = dec.ULC
   160  	}
   161  	if dec.SkipBcVersionCheck != nil {
   162  		c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
   163  	}
   164  	if dec.DatabaseHandles != nil {
   165  		c.DatabaseHandles = *dec.DatabaseHandles
   166  	}
   167  	if dec.DatabaseCache != nil {
   168  		c.DatabaseCache = *dec.DatabaseCache
   169  	}
   170  	if dec.DatabaseFreezer != nil {
   171  		c.DatabaseFreezer = *dec.DatabaseFreezer
   172  	}
   173  	if dec.TrieCleanCache != nil {
   174  		c.TrieCleanCache = *dec.TrieCleanCache
   175  	}
   176  	if dec.TrieDirtyCache != nil {
   177  		c.TrieDirtyCache = *dec.TrieDirtyCache
   178  	}
   179  	if dec.TrieTimeout != nil {
   180  		c.TrieTimeout = *dec.TrieTimeout
   181  	}
   182  	if dec.Miner != nil {
   183  		c.Miner = *dec.Miner
   184  	}
   185  	if dec.btpash != nil {
   186  		c.btpash = *dec.btpash
   187  	}
   188  	if dec.TxPool != nil {
   189  		c.TxPool = *dec.TxPool
   190  	}
   191  	if dec.GPO != nil {
   192  		c.GPO = *dec.GPO
   193  	}
   194  	if dec.EnablePreimageRecording != nil {
   195  		c.EnablePreimageRecording = *dec.EnablePreimageRecording
   196  	}
   197  	if dec.DocRoot != nil {
   198  		c.DocRoot = *dec.DocRoot
   199  	}
   200  	if dec.EWASMInterpreter != nil {
   201  		c.EWASMInterpreter = *dec.EWASMInterpreter
   202  	}
   203  	if dec.EVMInterpreter != nil {
   204  		c.EVMInterpreter = *dec.EVMInterpreter
   205  	}
   206  	if dec.RPCGasCap != nil {
   207  		c.RPCGasCap = dec.RPCGasCap
   208  	}
   209  	if dec.Checkpoint != nil {
   210  		c.Checkpoint = dec.Checkpoint
   211  	}
   212  	if dec.CheckpointOracle != nil {
   213  		c.CheckpointOracle = dec.CheckpointOracle
   214  	}
   215  	return nil
   216  }