mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
fix reduce change code
This commit is contained in:
parent
9bc7680c02
commit
b0e95fcc58
8 changed files with 66 additions and 69 deletions
|
|
@ -72,28 +72,28 @@ var tomlSettings = toml.Config{
|
|||
}
|
||||
|
||||
type ethstatsConfig struct {
|
||||
URL string `toml:"url"`
|
||||
URL string `toml:",omitempty"`
|
||||
}
|
||||
|
||||
type account struct {
|
||||
Unlocks []string `toml:"unlocks"`
|
||||
Passwords []string `toml:"passwords"`
|
||||
Unlocks []string
|
||||
Passwords []string
|
||||
}
|
||||
|
||||
type Bootnodes struct {
|
||||
Mainnet []string `toml:"main"`
|
||||
Testnet []string `toml:"test"`
|
||||
Mainnet []string
|
||||
Testnet []string
|
||||
}
|
||||
|
||||
type XDCConfig struct {
|
||||
Eth eth.Config `toml:"eth"`
|
||||
Shh whisper.Config `toml:"ssh"`
|
||||
Node node.Config `toml:"node"`
|
||||
Ethstats ethstatsConfig `toml:"ethstats"`
|
||||
Dashboard dashboard.Config `toml:"dashboard"`
|
||||
Account account `toml:"account"`
|
||||
StakeEnable bool `toml:"stake"`
|
||||
Bootnodes Bootnodes `toml:"bootnodes"`
|
||||
Eth eth.Config
|
||||
Shh whisper.Config
|
||||
Node node.Config
|
||||
Ethstats ethstatsConfig
|
||||
Dashboard dashboard.Config
|
||||
Account account
|
||||
StakeEnable bool
|
||||
Bootnodes Bootnodes
|
||||
}
|
||||
|
||||
func loadConfig(file string, cfg *XDCConfig) error {
|
||||
|
|
|
|||
29
cmd/XDC/testdata/XDC.toml
vendored
29
cmd/XDC/testdata/XDC.toml
vendored
|
|
@ -1,29 +0,0 @@
|
|||
|
||||
stake = true # flag --stake ( true : enable staker , false : disable )
|
||||
[eth]
|
||||
NetworkId = 1515 # flag --networkid
|
||||
SyncMode = "full" # flag --syncmode
|
||||
GasPrice = 1 # flag --gasprice
|
||||
|
||||
[ssh]
|
||||
|
||||
[node]
|
||||
datadir = "node1/" # flag --datadir
|
||||
http_host = "localhost" # flag --rpcaddr
|
||||
http_port = 8501 # flag --rpcport
|
||||
http_modules = ["personal","db","eth","net","web3","txpool","miner"] # flag --rpcapi
|
||||
[node.p2p]
|
||||
listenaddr = ":30311" # flag --port
|
||||
bootnodes = ["enode://a890c5762c406fe046fb93fd307577a8454d571b6bf789f7dbfbf3c559be751f5fa400bc10639691245a9b22be1cfce0bbf82b322a24d06c6dcf29bf7eeb930c@127.0.0.1:30310"]
|
||||
# flag --bootnodes
|
||||
|
||||
[ethstats]
|
||||
[dashboard]
|
||||
[account]
|
||||
unlocks = ["0x12f90a417f41bedd4bbcc99d52971803fb4c3f8b"] # list account slipt in flag --unlock
|
||||
passwords = ["PWD_DEVNET"] # list password in environment variable (split by ',') : ex : export PWD_DEVNET=123456,123456789
|
||||
|
||||
|
||||
[bootnodes]
|
||||
main =[]
|
||||
test =[]
|
||||
28
cmd/XDC/testdata/config.toml
vendored
Normal file
28
cmd/XDC/testdata/config.toml
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
StakeEnable = true # flag --miner ( true : enable staker , false : disable )
|
||||
[Eth]
|
||||
NetworkId = 89 # flag --networkid
|
||||
SyncMode = "full" # flag --syncmode
|
||||
GasPrice = 1 # flag --gasprice
|
||||
|
||||
[Shh]
|
||||
|
||||
[Node]
|
||||
DataDir = "node1/" # flag --datadir
|
||||
HTTPHost = "localhost" # flag --rpcaddr
|
||||
HTTPPort = 8501 # flag --rpcport
|
||||
HTTPModules = ["personal","db","eth","net","web3","txpool","miner"] # flag --rpcapi
|
||||
[Node.P2P]
|
||||
ListenAddr = ":30311" # flag --port
|
||||
BootstrapNodes = ["enode://a890c5762c406fe046fb93fd307577a8454d571b6bf789f7dbfbf3c559be751f5fa400bc10639691245a9b22be1cfce0bbf82b322a24d06c6dcf29bf7eeb930c@127.0.0.1:30310"]
|
||||
# flag --bootnodes
|
||||
|
||||
[Ethstats]
|
||||
[Dashboard]
|
||||
[Account]
|
||||
Unlocks = ["0x12f90a417f41bedd4bbcc99d52971803fb4c3f8b"] # list account slipt in flag --unlock
|
||||
Passwords = ["PWD_DEVNET"] # list password in environment variable (split by ',') : ex : export PWD_DEVNET=123456,123456789
|
||||
|
||||
|
||||
[Bootnodes]
|
||||
Mainnet =[]
|
||||
Testnet =[]
|
||||
|
|
@ -380,12 +380,12 @@ const (
|
|||
|
||||
// Config are the configuration parameters of the ethash.
|
||||
type Config struct {
|
||||
CacheDir string `toml:"cachedir"`
|
||||
CachesInMem int `toml:"cachesinmem"`
|
||||
CachesOnDisk int `toml:"cachesinmem"`
|
||||
DatasetDir string `toml:"cachesinmem"`
|
||||
DatasetsInMem int `toml:"cachesinmem"`
|
||||
DatasetsOnDisk int `toml:"cachesinmem"`
|
||||
CacheDir string
|
||||
CachesInMem int
|
||||
CachesOnDisk int
|
||||
DatasetDir string
|
||||
DatasetsInMem int
|
||||
DatasetsOnDisk int
|
||||
PowMode Mode
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ var DefaultConfig = Config{
|
|||
type Config struct {
|
||||
// Host is the host interface on which to start the dashboard server. If this
|
||||
// field is empty, no dashboard will be started.
|
||||
Host string `toml:"host,default=localhost"`
|
||||
Host string `toml:",omitempty"`
|
||||
|
||||
// Port is the TCP port number on which to start the dashboard server. The
|
||||
// default zero value is/ valid and will pick a port number randomly (useful
|
||||
// for ephemeral nodes).
|
||||
Port int `toml:"port,default=8080"`
|
||||
Port int `toml:",omitempty"`
|
||||
|
||||
// Refresh is the refresh rate of the data updates, the chartEntry will be collected this often.
|
||||
Refresh time.Duration
|
||||
Refresh time.Duration `toml:",omitempty"`
|
||||
}
|
||||
|
|
@ -79,11 +79,9 @@ type Config struct {
|
|||
Genesis *core.Genesis `toml:",omitempty"`
|
||||
|
||||
// Protocol options
|
||||
NetworkId uint64 `toml:"NetworkId,default=1"` // Network ID to use for selecting peers to connect to ,default=1
|
||||
SyncMode downloader.SyncMode `toml:"SyncMode,default=FastSync"`
|
||||
NoPruning bool
|
||||
|
||||
// Light client options
|
||||
NetworkId uint64 // Network ID to use for selecting peers to connect to
|
||||
SyncMode downloader.SyncMode NoPruning bool
|
||||
// Light client options
|
||||
LightServ int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
|
||||
LightPeers int `toml:",omitempty"` // Maximum number of LES client peers
|
||||
|
||||
|
|
@ -98,7 +96,7 @@ type Config struct {
|
|||
Etherbase common.Address `toml:",omitempty"`
|
||||
MinerThreads int `toml:",omitempty"`
|
||||
ExtraData []byte `toml:",omitempty"`
|
||||
GasPrice *big.Int `toml:"GasPrice"`
|
||||
GasPrice *big.Int
|
||||
|
||||
// Ethash options
|
||||
Ethash ethash.Config
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ type Config struct {
|
|||
Name string `toml:"-"`
|
||||
|
||||
// UserIdent, if set, is used as an additional component in the devp2p node identifier.
|
||||
UserIdent string `toml:"identity"`
|
||||
UserIdent string `toml:",omitempty"`
|
||||
|
||||
// Version should be set to the version number of the program. It is used
|
||||
// in the devp2p node identifier.
|
||||
|
|
@ -64,10 +64,10 @@ type Config struct {
|
|||
// registered services, instead those can use utility methods to create/access
|
||||
// databases or flat files. This enables ephemeral nodes which can fully reside
|
||||
// in memory.
|
||||
DataDir string `toml:"datadir"`
|
||||
|
||||
DataDir string
|
||||
|
||||
// Configuration of peer-to-peer networking.
|
||||
P2P p2p.Config `toml:"p2p"`
|
||||
P2P p2p.Config
|
||||
|
||||
// KeyStoreDir is the file system folder that contains private keys. The directory can
|
||||
// be specified as a relative path, in which case it is resolved relative to the
|
||||
|
|
@ -76,11 +76,11 @@ type Config struct {
|
|||
// If KeyStoreDir is empty, the default location is the "keystore" subdirectory of
|
||||
// DataDir. If DataDir is unspecified and KeyStoreDir is empty, an ephemeral directory
|
||||
// is created by New and destroyed when the node is stopped.
|
||||
KeyStoreDir string `toml:"keystore"`
|
||||
KeyStoreDir string `toml:",omitempty"`
|
||||
|
||||
// UseLightweightKDF lowers the memory and CPU requirements of the key store
|
||||
// scrypt KDF at the expense of security.
|
||||
UseLightweightKDF bool `toml:"lightkdf"`
|
||||
UseLightweightKDF bool `toml:",omitempty"`
|
||||
|
||||
// NoUSB disables hardware wallet monitoring and connectivity.
|
||||
NoUSB bool `toml:",omitempty"`
|
||||
|
|
@ -93,12 +93,12 @@ type Config struct {
|
|||
|
||||
// HTTPHost is the host interface on which to start the HTTP RPC server. If this
|
||||
// field is empty, no HTTP API endpoint will be started.
|
||||
HTTPHost string `toml:"http_host"`
|
||||
HTTPHost string `toml:",omitempty"`
|
||||
|
||||
// HTTPPort is the TCP port number on which to start the HTTP RPC server. The
|
||||
// default zero value is/ valid and will pick a port number randomly (useful
|
||||
// for ephemeral nodes).
|
||||
HTTPPort int `toml:"http_port"`
|
||||
HTTPPort int `toml:",omitempty"`
|
||||
|
||||
// HTTPCors is the Cross-Origin Resource Sharing header to send to requesting
|
||||
// clients. Please be aware that CORS is a browser enforced security, it's fully
|
||||
|
|
@ -117,7 +117,7 @@ type Config struct {
|
|||
// HTTPModules is a list of API modules to expose via the HTTP RPC interface.
|
||||
// If the module list is empty, all RPC API endpoints designated public will be
|
||||
// exposed.
|
||||
HTTPModules []string `toml:"http_modules"`
|
||||
HTTPModules []string `toml:",omitempty"`
|
||||
|
||||
// WSHost is the host interface on which to start the websocket RPC server. If
|
||||
// this field is empty, no websocket API endpoint will be started.
|
||||
|
|
|
|||
|
|
@ -86,12 +86,12 @@ type Config struct {
|
|||
|
||||
// BootstrapNodes are used to establish connectivity
|
||||
// with the rest of the network.
|
||||
BootstrapNodes []*discover.Node `toml:"bootnodes"`
|
||||
BootstrapNodes []*discover.Node
|
||||
|
||||
// BootstrapNodesV5 are used to establish connectivity
|
||||
// with the rest of the network using the V5 discovery
|
||||
// protocol.
|
||||
BootstrapNodesV5 []*discv5.Node `toml:"bootnodes_v5"`
|
||||
BootstrapNodesV5 []*discv5.Node `toml:",omitempty"`
|
||||
|
||||
// Static nodes are used as pre-configured connections which are always
|
||||
// maintained and re-connected on disconnects.
|
||||
|
|
@ -121,7 +121,7 @@ type Config struct {
|
|||
// If the port is zero, the operating system will pick a port. The
|
||||
// ListenAddr field will be updated with the actual address when
|
||||
// the server is started.
|
||||
ListenAddr string `toml:"listenaddr,default=30303"`
|
||||
ListenAddr string
|
||||
|
||||
// If set to a non-nil value, the given NAT port mapper
|
||||
// is used to make the listening port available to the
|
||||
|
|
|
|||
Loading…
Reference in a new issue