gen_config.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. // Code generated by github.com/fjl/gencodec. DO NOT EDIT.
  2. package eth
  3. import (
  4. "math/big"
  5. "github.com/ethereum/go-ethereum/common"
  6. "github.com/ethereum/go-ethereum/common/hexutil"
  7. "github.com/ethereum/go-ethereum/core"
  8. "github.com/ethereum/go-ethereum/eth/downloader"
  9. "github.com/ethereum/go-ethereum/eth/gasprice"
  10. )
  11. func (c Config) MarshalTOML() (interface{}, error) {
  12. type Config struct {
  13. Genesis *core.Genesis `toml:",omitempty"`
  14. NetworkId uint64
  15. SyncMode downloader.SyncMode
  16. LightServ int `toml:",omitempty"`
  17. LightPeers int `toml:",omitempty"`
  18. MaxPeers int `toml:"-"`
  19. SkipBcVersionCheck bool `toml:"-"`
  20. DatabaseHandles int `toml:"-"`
  21. DatabaseCache int
  22. Etherbase common.Address `toml:",omitempty"`
  23. MinerThreads int `toml:",omitempty"`
  24. ExtraData hexutil.Bytes `toml:",omitempty"`
  25. GasPrice *big.Int
  26. EthashCacheDir string
  27. EthashCachesInMem int
  28. EthashCachesOnDisk int
  29. EthashDatasetDir string
  30. EthashDatasetsInMem int
  31. EthashDatasetsOnDisk int
  32. TxPool core.TxPoolConfig
  33. GPO gasprice.Config
  34. EnablePreimageRecording bool
  35. DocRoot string `toml:"-"`
  36. PowFake bool `toml:"-"`
  37. PowTest bool `toml:"-"`
  38. PowShared bool `toml:"-"`
  39. }
  40. var enc Config
  41. enc.Genesis = c.Genesis
  42. enc.NetworkId = c.NetworkId
  43. enc.SyncMode = c.SyncMode
  44. enc.LightServ = c.LightServ
  45. enc.LightPeers = c.LightPeers
  46. enc.SkipBcVersionCheck = c.SkipBcVersionCheck
  47. enc.DatabaseHandles = c.DatabaseHandles
  48. enc.DatabaseCache = c.DatabaseCache
  49. enc.Etherbase = c.Etherbase
  50. enc.MinerThreads = c.MinerThreads
  51. enc.ExtraData = c.ExtraData
  52. enc.GasPrice = c.GasPrice
  53. enc.EthashCacheDir = c.EthashCacheDir
  54. enc.EthashCachesInMem = c.EthashCachesInMem
  55. enc.EthashCachesOnDisk = c.EthashCachesOnDisk
  56. enc.EthashDatasetDir = c.EthashDatasetDir
  57. enc.EthashDatasetsInMem = c.EthashDatasetsInMem
  58. enc.EthashDatasetsOnDisk = c.EthashDatasetsOnDisk
  59. enc.TxPool = c.TxPool
  60. enc.GPO = c.GPO
  61. enc.EnablePreimageRecording = c.EnablePreimageRecording
  62. enc.DocRoot = c.DocRoot
  63. enc.PowFake = c.PowFake
  64. enc.PowTest = c.PowTest
  65. enc.PowShared = c.PowShared
  66. return &enc, nil
  67. }
  68. func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
  69. type Config struct {
  70. Genesis *core.Genesis `toml:",omitempty"`
  71. NetworkId *uint64
  72. SyncMode *downloader.SyncMode
  73. LightServ *int `toml:",omitempty"`
  74. LightPeers *int `toml:",omitempty"`
  75. MaxPeers *int `toml:"-"`
  76. SkipBcVersionCheck *bool `toml:"-"`
  77. DatabaseHandles *int `toml:"-"`
  78. DatabaseCache *int
  79. Etherbase *common.Address `toml:",omitempty"`
  80. MinerThreads *int `toml:",omitempty"`
  81. ExtraData hexutil.Bytes `toml:",omitempty"`
  82. GasPrice *big.Int
  83. EthashCacheDir *string
  84. EthashCachesInMem *int
  85. EthashCachesOnDisk *int
  86. EthashDatasetDir *string
  87. EthashDatasetsInMem *int
  88. EthashDatasetsOnDisk *int
  89. TxPool *core.TxPoolConfig
  90. GPO *gasprice.Config
  91. EnablePreimageRecording *bool
  92. DocRoot *string `toml:"-"`
  93. PowFake *bool `toml:"-"`
  94. PowTest *bool `toml:"-"`
  95. PowShared *bool `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.EthashCacheDir = *dec.EthashCacheDir
  139. }
  140. if dec.EthashCachesInMem != nil {
  141. c.EthashCachesInMem = *dec.EthashCachesInMem
  142. }
  143. if dec.EthashCachesOnDisk != nil {
  144. c.EthashCachesOnDisk = *dec.EthashCachesOnDisk
  145. }
  146. if dec.EthashDatasetDir != nil {
  147. c.EthashDatasetDir = *dec.EthashDatasetDir
  148. }
  149. if dec.EthashDatasetsInMem != nil {
  150. c.EthashDatasetsInMem = *dec.EthashDatasetsInMem
  151. }
  152. if dec.EthashDatasetsOnDisk != nil {
  153. c.EthashDatasetsOnDisk = *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.PowFake != nil {
  168. c.PowFake = *dec.PowFake
  169. }
  170. if dec.PowTest != nil {
  171. c.PowTest = *dec.PowTest
  172. }
  173. if dec.PowShared != nil {
  174. c.PowShared = *dec.PowShared
  175. }
  176. return nil
  177. }