github.com/linapex/ethereum-go-chinese@v0.0.0-20190316121929-f8b7a73c3fa1/eth/gen_config.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 19:16:37</date> 10 //</624450089108115456> 11 12 //代码由github.com/fjl/gencodec生成。不要编辑。 13 14 package eth 15 16 import ( 17 "math/big" 18 "time" 19 20 "github.com/ethereum/go-ethereum/common" 21 "github.com/ethereum/go-ethereum/common/hexutil" 22 "github.com/ethereum/go-ethereum/consensus/ethash" 23 "github.com/ethereum/go-ethereum/core" 24 "github.com/ethereum/go-ethereum/eth/downloader" 25 "github.com/ethereum/go-ethereum/eth/gasprice" 26 ) 27 28 var _ = (*configMarshaling)(nil) 29 30 //MsHaltOML封为TOML。 31 func (c Config) MarshalTOML() (interface{}, error) { 32 type Config struct { 33 Genesis *core.Genesis `toml:",omitempty"` 34 NetworkId uint64 35 SyncMode downloader.SyncMode 36 NoPruning bool 37 LightServ int `toml:",omitempty"` 38 LightPeers int `toml:",omitempty"` 39 SkipBcVersionCheck bool `toml:"-"` 40 DatabaseHandles int `toml:"-"` 41 DatabaseCache int 42 TrieCleanCache int 43 TrieDirtyCache int 44 TrieTimeout time.Duration 45 Etherbase common.Address `toml:",omitempty"` 46 MinerNotify []string `toml:",omitempty"` 47 MinerExtraData hexutil.Bytes `toml:",omitempty"` 48 MinerGasFloor uint64 49 MinerGasCeil uint64 50 MinerGasPrice *big.Int 51 MinerRecommit time.Duration 52 MinerNoverify bool 53 Ethash ethash.Config 54 TxPool core.TxPoolConfig 55 GPO gasprice.Config 56 EnablePreimageRecording bool 57 DocRoot string `toml:"-"` 58 EWASMInterpreter string 59 EVMInterpreter string 60 } 61 var enc Config 62 enc.Genesis = c.Genesis 63 enc.NetworkId = c.NetworkId 64 enc.SyncMode = c.SyncMode 65 enc.NoPruning = c.NoPruning 66 enc.LightServ = c.LightServ 67 enc.LightPeers = c.LightPeers 68 enc.SkipBcVersionCheck = c.SkipBcVersionCheck 69 enc.DatabaseHandles = c.DatabaseHandles 70 enc.DatabaseCache = c.DatabaseCache 71 enc.TrieCleanCache = c.TrieCleanCache 72 enc.TrieDirtyCache = c.TrieDirtyCache 73 enc.TrieTimeout = c.TrieTimeout 74 enc.Etherbase = c.Etherbase 75 enc.MinerNotify = c.MinerNotify 76 enc.MinerExtraData = c.MinerExtraData 77 enc.MinerGasFloor = c.MinerGasFloor 78 enc.MinerGasCeil = c.MinerGasCeil 79 enc.MinerGasPrice = c.MinerGasPrice 80 enc.MinerRecommit = c.MinerRecommit 81 enc.MinerNoverify = c.MinerNoverify 82 enc.Ethash = c.Ethash 83 enc.TxPool = c.TxPool 84 enc.GPO = c.GPO 85 enc.EnablePreimageRecording = c.EnablePreimageRecording 86 enc.DocRoot = c.DocRoot 87 enc.EWASMInterpreter = c.EWASMInterpreter 88 enc.EVMInterpreter = c.EVMInterpreter 89 return &enc, nil 90 } 91 92 //取消标记从Toml取消标记。 93 func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { 94 type Config struct { 95 Genesis *core.Genesis `toml:",omitempty"` 96 NetworkId *uint64 97 SyncMode *downloader.SyncMode 98 NoPruning *bool 99 LightServ *int `toml:",omitempty"` 100 LightPeers *int `toml:",omitempty"` 101 SkipBcVersionCheck *bool `toml:"-"` 102 DatabaseHandles *int `toml:"-"` 103 DatabaseCache *int 104 TrieCleanCache *int 105 TrieDirtyCache *int 106 TrieTimeout *time.Duration 107 Etherbase *common.Address `toml:",omitempty"` 108 MinerNotify []string `toml:",omitempty"` 109 MinerExtraData *hexutil.Bytes `toml:",omitempty"` 110 MinerGasFloor *uint64 111 MinerGasCeil *uint64 112 MinerGasPrice *big.Int 113 MinerRecommit *time.Duration 114 MinerNoverify *bool 115 Ethash *ethash.Config 116 TxPool *core.TxPoolConfig 117 GPO *gasprice.Config 118 EnablePreimageRecording *bool 119 DocRoot *string `toml:"-"` 120 EWASMInterpreter *string 121 EVMInterpreter *string 122 } 123 var dec Config 124 if err := unmarshal(&dec); err != nil { 125 return err 126 } 127 if dec.Genesis != nil { 128 c.Genesis = dec.Genesis 129 } 130 if dec.NetworkId != nil { 131 c.NetworkId = *dec.NetworkId 132 } 133 if dec.SyncMode != nil { 134 c.SyncMode = *dec.SyncMode 135 } 136 if dec.NoPruning != nil { 137 c.NoPruning = *dec.NoPruning 138 } 139 if dec.LightServ != nil { 140 c.LightServ = *dec.LightServ 141 } 142 if dec.LightPeers != nil { 143 c.LightPeers = *dec.LightPeers 144 } 145 if dec.SkipBcVersionCheck != nil { 146 c.SkipBcVersionCheck = *dec.SkipBcVersionCheck 147 } 148 if dec.DatabaseHandles != nil { 149 c.DatabaseHandles = *dec.DatabaseHandles 150 } 151 if dec.DatabaseCache != nil { 152 c.DatabaseCache = *dec.DatabaseCache 153 } 154 if dec.TrieCleanCache != nil { 155 c.TrieCleanCache = *dec.TrieCleanCache 156 } 157 if dec.TrieDirtyCache != nil { 158 c.TrieDirtyCache = *dec.TrieDirtyCache 159 } 160 if dec.TrieTimeout != nil { 161 c.TrieTimeout = *dec.TrieTimeout 162 } 163 if dec.Etherbase != nil { 164 c.Etherbase = *dec.Etherbase 165 } 166 if dec.MinerNotify != nil { 167 c.MinerNotify = dec.MinerNotify 168 } 169 if dec.MinerExtraData != nil { 170 c.MinerExtraData = *dec.MinerExtraData 171 } 172 if dec.MinerGasFloor != nil { 173 c.MinerGasFloor = *dec.MinerGasFloor 174 } 175 if dec.MinerGasCeil != nil { 176 c.MinerGasCeil = *dec.MinerGasCeil 177 } 178 if dec.MinerGasPrice != nil { 179 c.MinerGasPrice = dec.MinerGasPrice 180 } 181 if dec.MinerRecommit != nil { 182 c.MinerRecommit = *dec.MinerRecommit 183 } 184 if dec.MinerNoverify != nil { 185 c.MinerNoverify = *dec.MinerNoverify 186 } 187 if dec.Ethash != nil { 188 c.Ethash = *dec.Ethash 189 } 190 if dec.TxPool != nil { 191 c.TxPool = *dec.TxPool 192 } 193 if dec.GPO != nil { 194 c.GPO = *dec.GPO 195 } 196 if dec.EnablePreimageRecording != nil { 197 c.EnablePreimageRecording = *dec.EnablePreimageRecording 198 } 199 if dec.DocRoot != nil { 200 c.DocRoot = *dec.DocRoot 201 } 202 if dec.EWASMInterpreter != nil { 203 c.EWASMInterpreter = *dec.EWASMInterpreter 204 } 205 if dec.EVMInterpreter != nil { 206 c.EVMInterpreter = *dec.EVMInterpreter 207 } 208 return nil 209 } 210