aboutsummaryrefslogtreecommitdiffstats
path: root/eth/gen_config.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-04-12 22:27:23 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-04-12 22:27:23 +0800
commit30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2 (patch)
tree3ec076154049f1fa71b19fd9b7762085059ff15b /eth/gen_config.go
parentb57680b0b21036460c689aab1e82d89297738d50 (diff)
downloaddexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.tar
dexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.tar.gz
dexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.tar.bz2
dexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.tar.lz
dexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.tar.xz
dexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.tar.zst
dexon-30d706c35e16305e2e3ec0eb6a6bdd6aba50d9d2.zip
cmd/geth: add --config file flag (#13875)
* p2p/discover, p2p/discv5: add marshaling methods to Node * p2p/netutil: make Netlist decodable from TOML * common/math: encode nil HexOrDecimal256 as 0x0 * cmd/geth: add --config file flag * cmd/geth: add missing license header * eth: prettify Config again, fix tests * eth: use gasprice.Config instead of duplicating its fields * eth/gasprice: hide nil default from dumpconfig output * cmd/geth: hide genesis block in dumpconfig output * node: make tests compile * console: fix tests * cmd/geth: make TOML keys look exactly like Go struct fields * p2p: use discovery by default This makes the zero Config slightly more useful. It also fixes package node tests because Node detects reuse of the datadir through the NodeDatabase. * cmd/geth: make ethstats URL settable through config file * cmd/faucet: fix configuration * cmd/geth: dedup attach tests * eth: add comment for DefaultConfig * eth: pass downloader.SyncMode in Config This removes the FastSync, LightSync flags in favour of a more general SyncMode flag. * cmd/utils: remove jitvm flags * cmd/utils: make mutually exclusive flag error prettier It now reads: Fatal: flags --dev, --testnet can't be used at the same time * p2p: fix typo * node: add DefaultConfig, use it for geth * mobile: add missing NoDiscovery option * cmd/utils: drop MakeNode This exposed a couple of places that needed to be updated to use node.DefaultConfig. * node: fix typo * eth: make fast sync the default mode * cmd/utils: remove IPCApiFlag (unused) * node: remove default IPC path Set it in the frontends instead. * cmd/geth: add --syncmode * cmd/utils: make --ipcdisable and --ipcpath mutually exclusive * cmd/utils: don't enable WS, HTTP when setting addr * cmd/utils: fix --identity
Diffstat (limited to 'eth/gen_config.go')
-rw-r--r--eth/gen_config.go186
1 files changed, 186 insertions, 0 deletions
diff --git a/eth/gen_config.go b/eth/gen_config.go
new file mode 100644
index 000000000..d34273e1c
--- /dev/null
+++ b/eth/gen_config.go
@@ -0,0 +1,186 @@
+// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
+
+package eth
+
+import (
+ "math/big"
+
+ "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/hexutil"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/eth/downloader"
+ "github.com/ethereum/go-ethereum/eth/gasprice"
+)
+
+func (c Config) MarshalTOML() (interface{}, error) {
+ type Config struct {
+ Genesis *core.Genesis `toml:",omitempty"`
+ NetworkId int
+ SyncMode downloader.SyncMode
+ LightServ int `toml:",omitempty"`
+ LightPeers int `toml:",omitempty"`
+ MaxPeers int `toml:"-"`
+ SkipBcVersionCheck bool `toml:"-"`
+ DatabaseHandles int `toml:"-"`
+ DatabaseCache int
+ Etherbase common.Address `toml:",omitempty"`
+ MinerThreads int `toml:",omitempty"`
+ ExtraData hexutil.Bytes `toml:",omitempty"`
+ GasPrice *big.Int
+ EthashCacheDir string
+ EthashCachesInMem int
+ EthashCachesOnDisk int
+ EthashDatasetDir string
+ EthashDatasetsInMem int
+ EthashDatasetsOnDisk int
+ GPO gasprice.Config
+ EnablePreimageRecording bool
+ SolcPath string
+ DocRoot string `toml:"-"`
+ PowFake bool `toml:"-"`
+ PowTest bool `toml:"-"`
+ PowShared bool `toml:"-"`
+ }
+ var enc Config
+ enc.Genesis = c.Genesis
+ enc.NetworkId = c.NetworkId
+ enc.SyncMode = c.SyncMode
+ enc.LightServ = c.LightServ
+ enc.LightPeers = c.LightPeers
+ enc.MaxPeers = c.MaxPeers
+ enc.SkipBcVersionCheck = c.SkipBcVersionCheck
+ enc.DatabaseHandles = c.DatabaseHandles
+ enc.DatabaseCache = c.DatabaseCache
+ enc.Etherbase = c.Etherbase
+ enc.MinerThreads = c.MinerThreads
+ enc.ExtraData = c.ExtraData
+ enc.GasPrice = c.GasPrice
+ enc.EthashCacheDir = c.EthashCacheDir
+ enc.EthashCachesInMem = c.EthashCachesInMem
+ enc.EthashCachesOnDisk = c.EthashCachesOnDisk
+ enc.EthashDatasetDir = c.EthashDatasetDir
+ enc.EthashDatasetsInMem = c.EthashDatasetsInMem
+ enc.EthashDatasetsOnDisk = c.EthashDatasetsOnDisk
+ enc.GPO = c.GPO
+ enc.EnablePreimageRecording = c.EnablePreimageRecording
+ enc.SolcPath = c.SolcPath
+ enc.DocRoot = c.DocRoot
+ enc.PowFake = c.PowFake
+ enc.PowTest = c.PowTest
+ enc.PowShared = c.PowShared
+ return &enc, nil
+}
+
+func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
+ type Config struct {
+ Genesis *core.Genesis `toml:",omitempty"`
+ NetworkId *int
+ SyncMode *downloader.SyncMode
+ LightServ *int `toml:",omitempty"`
+ LightPeers *int `toml:",omitempty"`
+ MaxPeers *int `toml:"-"`
+ SkipBcVersionCheck *bool `toml:"-"`
+ DatabaseHandles *int `toml:"-"`
+ DatabaseCache *int
+ Etherbase *common.Address `toml:",omitempty"`
+ MinerThreads *int `toml:",omitempty"`
+ ExtraData hexutil.Bytes `toml:",omitempty"`
+ GasPrice *big.Int
+ EthashCacheDir *string
+ EthashCachesInMem *int
+ EthashCachesOnDisk *int
+ EthashDatasetDir *string
+ EthashDatasetsInMem *int
+ EthashDatasetsOnDisk *int
+ GPO *gasprice.Config
+ EnablePreimageRecording *bool
+ SolcPath *string
+ DocRoot *string `toml:"-"`
+ PowFake *bool `toml:"-"`
+ PowTest *bool `toml:"-"`
+ PowShared *bool `toml:"-"`
+ }
+ var dec Config
+ if err := unmarshal(&dec); err != nil {
+ return err
+ }
+ if dec.Genesis != nil {
+ c.Genesis = dec.Genesis
+ }
+ if dec.NetworkId != nil {
+ c.NetworkId = *dec.NetworkId
+ }
+ if dec.SyncMode != nil {
+ c.SyncMode = *dec.SyncMode
+ }
+ if dec.LightServ != nil {
+ c.LightServ = *dec.LightServ
+ }
+ if dec.LightPeers != nil {
+ c.LightPeers = *dec.LightPeers
+ }
+ if dec.MaxPeers != nil {
+ c.MaxPeers = *dec.MaxPeers
+ }
+ if dec.SkipBcVersionCheck != nil {
+ c.SkipBcVersionCheck = *dec.SkipBcVersionCheck
+ }
+ if dec.DatabaseHandles != nil {
+ c.DatabaseHandles = *dec.DatabaseHandles
+ }
+ if dec.DatabaseCache != nil {
+ c.DatabaseCache = *dec.DatabaseCache
+ }
+ if dec.Etherbase != nil {
+ c.Etherbase = *dec.Etherbase
+ }
+ if dec.MinerThreads != nil {
+ c.MinerThreads = *dec.MinerThreads
+ }
+ if dec.ExtraData != nil {
+ c.ExtraData = dec.ExtraData
+ }
+ if dec.GasPrice != nil {
+ c.GasPrice = dec.GasPrice
+ }
+ if dec.EthashCacheDir != nil {
+ c.EthashCacheDir = *dec.EthashCacheDir
+ }
+ if dec.EthashCachesInMem != nil {
+ c.EthashCachesInMem = *dec.EthashCachesInMem
+ }
+ if dec.EthashCachesOnDisk != nil {
+ c.EthashCachesOnDisk = *dec.EthashCachesOnDisk
+ }
+ if dec.EthashDatasetDir != nil {
+ c.EthashDatasetDir = *dec.EthashDatasetDir
+ }
+ if dec.EthashDatasetsInMem != nil {
+ c.EthashDatasetsInMem = *dec.EthashDatasetsInMem
+ }
+ if dec.EthashDatasetsOnDisk != nil {
+ c.EthashDatasetsOnDisk = *dec.EthashDatasetsOnDisk
+ }
+ if dec.GPO != nil {
+ c.GPO = *dec.GPO
+ }
+ if dec.EnablePreimageRecording != nil {
+ c.EnablePreimageRecording = *dec.EnablePreimageRecording
+ }
+ if dec.SolcPath != nil {
+ c.SolcPath = *dec.SolcPath
+ }
+ if dec.DocRoot != nil {
+ c.DocRoot = *dec.DocRoot
+ }
+ if dec.PowFake != nil {
+ c.PowFake = *dec.PowFake
+ }
+ if dec.PowTest != nil {
+ c.PowTest = *dec.PowTest
+ }
+ if dec.PowShared != nil {
+ c.PowShared = *dec.PowShared
+ }
+ return nil
+}