github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/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 8 "github.com/SmartMeshFoundation/Spectrum/common" 9 "github.com/SmartMeshFoundation/Spectrum/common/hexutil" 10 "github.com/SmartMeshFoundation/Spectrum/consensus/ethash" 11 "github.com/SmartMeshFoundation/Spectrum/core" 12 "github.com/SmartMeshFoundation/Spectrum/eth/downloader" 13 "github.com/SmartMeshFoundation/Spectrum/eth/gasprice" 14 ) 15 16 func (c Config) MarshalTOML() (interface{}, error) { 17 type Config struct { 18 Genesis *core.Genesis `toml:",omitempty"` 19 NetworkId uint64 20 SyncMode downloader.SyncMode 21 LightServ int `toml:",omitempty"` 22 LightPeers int `toml:",omitempty"` 23 MaxPeers int `toml:"-"` 24 SkipBcVersionCheck bool `toml:"-"` 25 DatabaseHandles int `toml:"-"` 26 DatabaseCache int 27 Etherbase common.Address `toml:",omitempty"` 28 MinerThreads int `toml:",omitempty"` 29 ExtraData hexutil.Bytes `toml:",omitempty"` 30 GasPrice *big.Int 31 EthashCacheDir string 32 EthashCachesInMem int 33 EthashCachesOnDisk int 34 EthashDatasetDir string 35 EthashDatasetsInMem int 36 EthashDatasetsOnDisk int 37 TxPool core.TxPoolConfig 38 GPO gasprice.Config 39 EnablePreimageRecording bool 40 DocRoot string `toml:"-"` 41 PowMode ethash.Mode `toml:"-"` 42 } 43 var enc Config 44 enc.Genesis = c.Genesis 45 enc.NetworkId = c.NetworkId 46 enc.SyncMode = c.SyncMode 47 enc.LightServ = c.LightServ 48 enc.LightPeers = c.LightPeers 49 enc.SkipBcVersionCheck = c.SkipBcVersionCheck 50 enc.DatabaseHandles = c.DatabaseHandles 51 enc.DatabaseCache = c.DatabaseCache 52 enc.Etherbase = c.Etherbase 53 enc.MinerThreads = c.MinerThreads 54 enc.ExtraData = c.ExtraData 55 enc.GasPrice = c.GasPrice 56 enc.EthashCacheDir = c.Ethash.CacheDir 57 enc.EthashCachesInMem = c.Ethash.CachesInMem 58 enc.EthashCachesOnDisk = c.Ethash.CachesOnDisk 59 enc.EthashDatasetDir = c.Ethash.DatasetDir 60 enc.EthashDatasetsInMem = c.Ethash.DatasetsInMem 61 enc.EthashDatasetsOnDisk = c.Ethash.DatasetsOnDisk 62 enc.TxPool = c.TxPool 63 enc.GPO = c.GPO 64 enc.EnablePreimageRecording = c.EnablePreimageRecording 65 enc.DocRoot = c.DocRoot 66 enc.PowMode = c.Ethash.PowMode 67 return &enc, nil 68 } 69 70 func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { 71 type Config struct { 72 Genesis *core.Genesis `toml:",omitempty"` 73 NetworkId *uint64 74 SyncMode *downloader.SyncMode 75 LightServ *int `toml:",omitempty"` 76 LightPeers *int `toml:",omitempty"` 77 MaxPeers *int `toml:"-"` 78 SkipBcVersionCheck *bool `toml:"-"` 79 DatabaseHandles *int `toml:"-"` 80 DatabaseCache *int 81 Etherbase *common.Address `toml:",omitempty"` 82 MinerThreads *int `toml:",omitempty"` 83 ExtraData hexutil.Bytes `toml:",omitempty"` 84 GasPrice *big.Int 85 EthashCacheDir *string 86 EthashCachesInMem *int 87 EthashCachesOnDisk *int 88 EthashDatasetDir *string 89 EthashDatasetsInMem *int 90 EthashDatasetsOnDisk *int 91 TxPool *core.TxPoolConfig 92 GPO *gasprice.Config 93 EnablePreimageRecording *bool 94 DocRoot *string `toml:"-"` 95 PowMode *ethash.Mode `toml:"-"` 96 } 97 var dec Config 98 if err := unmarshal(&dec); err != nil { 99 return err 100 } 101 if dec.Genesis != nil { 102 c.Genesis = dec.Genesis 103 } 104 if dec.NetworkId != nil { 105 c.NetworkId = *dec.NetworkId 106 } 107 if dec.SyncMode != nil { 108 c.SyncMode = *dec.SyncMode 109 } 110 if dec.LightServ != nil { 111 c.LightServ = *dec.LightServ 112 } 113 if dec.LightPeers != nil { 114 c.LightPeers = *dec.LightPeers 115 } 116 if dec.SkipBcVersionCheck != nil { 117 c.SkipBcVersionCheck = *dec.SkipBcVersionCheck 118 } 119 if dec.DatabaseHandles != nil { 120 c.DatabaseHandles = *dec.DatabaseHandles 121 } 122 if dec.DatabaseCache != nil { 123 c.DatabaseCache = *dec.DatabaseCache 124 } 125 if dec.Etherbase != nil { 126 c.Etherbase = *dec.Etherbase 127 } 128 if dec.MinerThreads != nil { 129 c.MinerThreads = *dec.MinerThreads 130 } 131 if dec.ExtraData != nil { 132 c.ExtraData = dec.ExtraData 133 } 134 if dec.GasPrice != nil { 135 c.GasPrice = dec.GasPrice 136 } 137 if dec.EthashCacheDir != nil { 138 c.Ethash.CacheDir = *dec.EthashCacheDir 139 } 140 if dec.EthashCachesInMem != nil { 141 c.Ethash.CachesInMem = *dec.EthashCachesInMem 142 } 143 if dec.EthashCachesOnDisk != nil { 144 c.Ethash.CachesOnDisk = *dec.EthashCachesOnDisk 145 } 146 if dec.EthashDatasetDir != nil { 147 c.Ethash.DatasetDir = *dec.EthashDatasetDir 148 } 149 if dec.EthashDatasetsInMem != nil { 150 c.Ethash.DatasetsInMem = *dec.EthashDatasetsInMem 151 } 152 if dec.EthashDatasetsOnDisk != nil { 153 c.Ethash.DatasetsOnDisk = *dec.EthashDatasetsOnDisk 154 } 155 if dec.TxPool != nil { 156 c.TxPool = *dec.TxPool 157 } 158 if dec.GPO != nil { 159 c.GPO = *dec.GPO 160 } 161 if dec.EnablePreimageRecording != nil { 162 c.EnablePreimageRecording = *dec.EnablePreimageRecording 163 } 164 if dec.DocRoot != nil { 165 c.DocRoot = *dec.DocRoot 166 } 167 if dec.PowMode != nil { 168 c.Ethash.PowMode = *dec.PowMode 169 } 170 return nil 171 }