mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 07:23:46 +00:00
Remove pointers in config field
This commit is contained in:
parent
2b7bd156cf
commit
3d3f986c5b
5 changed files with 325 additions and 336 deletions
|
|
@ -78,9 +78,10 @@ func (f *Flagset) StringFlag(b *StringFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type IntFlag struct {
|
type IntFlag struct {
|
||||||
Name string
|
Name string
|
||||||
Usage string
|
Usage string
|
||||||
Value *int
|
Value *int
|
||||||
|
Default int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Flagset) IntFlag(i *IntFlag) {
|
func (f *Flagset) IntFlag(i *IntFlag) {
|
||||||
|
|
@ -88,13 +89,14 @@ func (f *Flagset) IntFlag(i *IntFlag) {
|
||||||
Name: i.Name,
|
Name: i.Name,
|
||||||
Usage: i.Usage,
|
Usage: i.Usage,
|
||||||
})
|
})
|
||||||
f.set.IntVar(i.Value, i.Name, *i.Value, i.Usage)
|
f.set.IntVar(i.Value, i.Name, i.Default, i.Usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Uint64Flag struct {
|
type Uint64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
Usage string
|
Usage string
|
||||||
Value *uint64
|
Value *uint64
|
||||||
|
Default uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Flagset) Uint64Flag(i *Uint64Flag) {
|
func (f *Flagset) Uint64Flag(i *Uint64Flag) {
|
||||||
|
|
@ -102,7 +104,7 @@ func (f *Flagset) Uint64Flag(i *Uint64Flag) {
|
||||||
Name: i.Name,
|
Name: i.Name,
|
||||||
Usage: i.Usage,
|
Usage: i.Usage,
|
||||||
})
|
})
|
||||||
f.set.Uint64Var(i.Value, i.Name, *i.Value, i.Usage)
|
f.set.Uint64Var(i.Value, i.Name, i.Default, i.Usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
type BigIntFlag struct {
|
type BigIntFlag struct {
|
||||||
|
|
@ -169,9 +171,10 @@ func (f *Flagset) SliceStringFlag(s *SliceStringFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type DurationFlag struct {
|
type DurationFlag struct {
|
||||||
Name string
|
Name string
|
||||||
Usage string
|
Usage string
|
||||||
Value *time.Duration
|
Value *time.Duration
|
||||||
|
Default time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Flagset) DurationFlag(d *DurationFlag) {
|
func (f *Flagset) DurationFlag(d *DurationFlag) {
|
||||||
|
|
@ -179,7 +182,7 @@ func (f *Flagset) DurationFlag(d *DurationFlag) {
|
||||||
Name: d.Name,
|
Name: d.Name,
|
||||||
Usage: d.Usage,
|
Usage: d.Usage,
|
||||||
})
|
})
|
||||||
f.set.DurationVar(d.Value, d.Name, *d.Value, "")
|
f.set.DurationVar(d.Value, d.Name, d.Default, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
type MapStringFlag struct {
|
type MapStringFlag struct {
|
||||||
|
|
@ -224,9 +227,10 @@ func (f *Flagset) MapStringFlag(m *MapStringFlag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Float64Flag struct {
|
type Float64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
Usage string
|
Usage string
|
||||||
Value *float64
|
Value *float64
|
||||||
|
Default float64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Flagset) Float64Flag(i *Float64Flag) {
|
func (f *Flagset) Float64Flag(i *Float64Flag) {
|
||||||
|
|
@ -234,5 +238,5 @@ func (f *Flagset) Float64Flag(i *Float64Flag) {
|
||||||
Name: i.Name,
|
Name: i.Name,
|
||||||
Usage: i.Usage,
|
Usage: i.Usage,
|
||||||
})
|
})
|
||||||
f.set.Float64Var(i.Value, i.Name, *i.Value, "")
|
f.set.Float64Var(i.Value, i.Name, i.Default, "")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ func (c *Command) Run(args []string) int {
|
||||||
c.config = config
|
c.config = config
|
||||||
|
|
||||||
// start the logger
|
// start the logger
|
||||||
setupLogger(*config.LogLevel)
|
setupLogger(config.LogLevel)
|
||||||
|
|
||||||
// load the chain genesis
|
// load the chain genesis
|
||||||
if err := config.loadChain(); err != nil {
|
if err := config.loadChain(); err != nil {
|
||||||
|
|
@ -122,7 +122,7 @@ func (c *Command) Run(args []string) int {
|
||||||
stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
|
stack.RegisterAPIs(tracers.APIs(backend.APIBackend))
|
||||||
|
|
||||||
// graphql is started from another place
|
// graphql is started from another place
|
||||||
if *config.JsonRPC.Graphql.Enabled {
|
if config.JsonRPC.Graphql.Enabled {
|
||||||
if err := graphql.New(stack, backend.APIBackend, config.JsonRPC.Cors, config.JsonRPC.Modules); err != nil {
|
if err := graphql.New(stack, backend.APIBackend, config.JsonRPC.Cors, config.JsonRPC.Modules); err != nil {
|
||||||
c.UI.Error(fmt.Sprintf("Failed to register the GraphQL service: %v", err))
|
c.UI.Error(fmt.Sprintf("Failed to register the GraphQL service: %v", err))
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -130,8 +130,8 @@ func (c *Command) Run(args []string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// register ethash service
|
// register ethash service
|
||||||
if *config.EthStats != "" {
|
if config.EthStats != "" {
|
||||||
if err := ethstats.New(stack, backend.APIBackend, backend.Engine(), *config.EthStats); err != nil {
|
if err := ethstats.New(stack, backend.APIBackend, backend.Engine(), config.EthStats); err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +142,7 @@ func (c *Command) Run(args []string) int {
|
||||||
{
|
{
|
||||||
keydir := stack.KeyStoreDir()
|
keydir := stack.KeyStoreDir()
|
||||||
n, p := keystore.StandardScryptN, keystore.StandardScryptP
|
n, p := keystore.StandardScryptN, keystore.StandardScryptP
|
||||||
if *config.Accounts.UseLightweightKDF {
|
if config.Accounts.UseLightweightKDF {
|
||||||
n, p = keystore.LightScryptN, keystore.LightScryptP
|
n, p = keystore.LightScryptN, keystore.LightScryptP
|
||||||
}
|
}
|
||||||
borKeystore = keystore.NewKeyStore(keydir, n, p)
|
borKeystore = keystore.NewKeyStore(keydir, n, p)
|
||||||
|
|
@ -158,7 +158,7 @@ func (c *Command) Run(args []string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sealing (if enabled)
|
// sealing (if enabled)
|
||||||
if *config.Sealer.Enabled {
|
if config.Sealer.Enabled {
|
||||||
if err := backend.StartMining(1); err != nil {
|
if err := backend.StartMining(1); err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 1
|
return 1
|
||||||
|
|
@ -186,9 +186,9 @@ func (c *Command) unlockAccounts(borKeystore *keystore.KeyStore) error {
|
||||||
|
|
||||||
// read passwords from file if possible
|
// read passwords from file if possible
|
||||||
passwords := []string{}
|
passwords := []string{}
|
||||||
if *c.config.Accounts.PasswordFile != "" {
|
if c.config.Accounts.PasswordFile != "" {
|
||||||
var err error
|
var err error
|
||||||
if passwords, err = readMultilineFile(*c.config.Accounts.PasswordFile); err != nil {
|
if passwords, err = readMultilineFile(c.config.Accounts.PasswordFile); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -222,8 +222,8 @@ func (c *Command) unlockAccounts(borKeystore *keystore.KeyStore) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Command) setupMetrics(config *MetricsConfig) error {
|
func (c *Command) setupMetrics(config *MetricsConfig) error {
|
||||||
metrics.Enabled = *config.Enabled
|
metrics.Enabled = config.Enabled
|
||||||
metrics.EnabledExpensive = *config.Expensive
|
metrics.EnabledExpensive = config.Expensive
|
||||||
|
|
||||||
if !metrics.Enabled {
|
if !metrics.Enabled {
|
||||||
// metrics are disabled, do not set up any sink
|
// metrics are disabled, do not set up any sink
|
||||||
|
|
@ -233,22 +233,22 @@ func (c *Command) setupMetrics(config *MetricsConfig) error {
|
||||||
log.Info("Enabling metrics collection")
|
log.Info("Enabling metrics collection")
|
||||||
|
|
||||||
// influxdb
|
// influxdb
|
||||||
if v1Enabled, v2Enabled := (*config.InfluxDB.V1Enabled), (*config.InfluxDB.V2Enabled); v1Enabled || v2Enabled {
|
if v1Enabled, v2Enabled := (config.InfluxDB.V1Enabled), (config.InfluxDB.V2Enabled); v1Enabled || v2Enabled {
|
||||||
if v1Enabled && v2Enabled {
|
if v1Enabled && v2Enabled {
|
||||||
return fmt.Errorf("both influx v1 and influx v2 cannot be enabled")
|
return fmt.Errorf("both influx v1 and influx v2 cannot be enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := config.InfluxDB
|
cfg := config.InfluxDB
|
||||||
tags := *cfg.Tags
|
tags := cfg.Tags
|
||||||
endpoint := *cfg.Endpoint
|
endpoint := cfg.Endpoint
|
||||||
|
|
||||||
if v1Enabled {
|
if v1Enabled {
|
||||||
log.Info("Enabling metrics export to InfluxDB (v1)")
|
log.Info("Enabling metrics export to InfluxDB (v1)")
|
||||||
go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, *cfg.Database, *cfg.Username, *cfg.Password, "geth.", tags)
|
go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, cfg.Database, cfg.Username, cfg.Password, "geth.", tags)
|
||||||
}
|
}
|
||||||
if v2Enabled {
|
if v2Enabled {
|
||||||
log.Info("Enabling metrics export to InfluxDB (v2)")
|
log.Info("Enabling metrics export to InfluxDB (v2)")
|
||||||
go influxdb.InfluxDBV2WithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, *cfg.Token, *cfg.Bucket, *cfg.Organization, "geth.", tags)
|
go influxdb.InfluxDBV2WithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, cfg.Token, cfg.Bucket, cfg.Organization, "geth.", tags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,66 +30,42 @@ import (
|
||||||
gopsutil "github.com/shirou/gopsutil/mem"
|
gopsutil "github.com/shirou/gopsutil/mem"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mapStrPtr(m map[string]string) *map[string]string {
|
|
||||||
return &m
|
|
||||||
}
|
|
||||||
|
|
||||||
func stringPtr(s string) *string {
|
|
||||||
return &s
|
|
||||||
}
|
|
||||||
|
|
||||||
func float64Ptr(f float64) *float64 {
|
|
||||||
return &f
|
|
||||||
}
|
|
||||||
|
|
||||||
func uint64Ptr(i uint64) *uint64 {
|
|
||||||
return &i
|
|
||||||
}
|
|
||||||
|
|
||||||
func boolPtr(b bool) *bool {
|
|
||||||
return &b
|
|
||||||
}
|
|
||||||
|
|
||||||
func durPtr(d time.Duration) *time.Duration {
|
|
||||||
return &d
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
chain *chains.Chain
|
chain *chains.Chain
|
||||||
|
|
||||||
Chain *string
|
Chain string
|
||||||
Debug *bool
|
Debug bool
|
||||||
Whitelist *map[string]string
|
Whitelist map[string]string
|
||||||
LogLevel *string
|
LogLevel string
|
||||||
DataDir *string
|
DataDir string
|
||||||
P2P *P2PConfig
|
P2P *P2PConfig
|
||||||
SyncMode *string
|
SyncMode string
|
||||||
GcMode *string
|
GcMode string
|
||||||
Snapshot *bool
|
Snapshot bool
|
||||||
EthStats *string
|
EthStats string
|
||||||
Heimdall *HeimdallConfig
|
Heimdall *HeimdallConfig
|
||||||
TxPool *TxPoolConfig
|
TxPool *TxPoolConfig
|
||||||
Sealer *SealerConfig
|
Sealer *SealerConfig
|
||||||
JsonRPC *JsonRPCConfig
|
JsonRPC *JsonRPCConfig
|
||||||
Gpo *GpoConfig
|
Gpo *GpoConfig
|
||||||
Ethstats *string
|
Ethstats string
|
||||||
Metrics *MetricsConfig
|
Metrics *MetricsConfig
|
||||||
Cache *CacheConfig
|
Cache *CacheConfig
|
||||||
Accounts *AccountsConfig
|
Accounts *AccountsConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type P2PConfig struct {
|
type P2PConfig struct {
|
||||||
MaxPeers *uint64
|
MaxPeers uint64
|
||||||
MaxPendPeers *uint64
|
MaxPendPeers uint64
|
||||||
Bind *string
|
Bind string
|
||||||
Port *uint64
|
Port uint64
|
||||||
NoDiscover *bool
|
NoDiscover bool
|
||||||
NAT *string
|
NAT string
|
||||||
Discovery *P2PDiscovery
|
Discovery *P2PDiscovery
|
||||||
}
|
}
|
||||||
|
|
||||||
type P2PDiscovery struct {
|
type P2PDiscovery struct {
|
||||||
V5Enabled *bool
|
V5Enabled bool
|
||||||
Bootnodes []string
|
Bootnodes []string
|
||||||
BootnodesV4 []string
|
BootnodesV4 []string
|
||||||
BootnodesV5 []string
|
BootnodesV5 []string
|
||||||
|
|
@ -99,42 +75,42 @@ type P2PDiscovery struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type HeimdallConfig struct {
|
type HeimdallConfig struct {
|
||||||
URL *string
|
URL string
|
||||||
Without *bool
|
Without bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type TxPoolConfig struct {
|
type TxPoolConfig struct {
|
||||||
Locals []string
|
Locals []string
|
||||||
NoLocals *bool
|
NoLocals bool
|
||||||
Journal *string
|
Journal string
|
||||||
Rejournal *time.Duration
|
Rejournal time.Duration
|
||||||
PriceLimit *uint64
|
PriceLimit uint64
|
||||||
PriceBump *uint64
|
PriceBump uint64
|
||||||
AccountSlots *uint64
|
AccountSlots uint64
|
||||||
GlobalSlots *uint64
|
GlobalSlots uint64
|
||||||
AccountQueue *uint64
|
AccountQueue uint64
|
||||||
GlobalQueue *uint64
|
GlobalQueue uint64
|
||||||
LifeTime *time.Duration
|
LifeTime time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
type SealerConfig struct {
|
type SealerConfig struct {
|
||||||
Enabled *bool
|
Enabled bool
|
||||||
Etherbase *string
|
Etherbase string
|
||||||
ExtraData *string
|
ExtraData string
|
||||||
GasCeil *uint64
|
GasCeil uint64
|
||||||
GasPrice *big.Int
|
GasPrice *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type JsonRPCConfig struct {
|
type JsonRPCConfig struct {
|
||||||
IPCDisable *bool
|
IPCDisable bool
|
||||||
IPCPath *string
|
IPCPath string
|
||||||
|
|
||||||
Modules []string
|
Modules []string
|
||||||
VHost []string
|
VHost []string
|
||||||
Cors []string
|
Cors []string
|
||||||
|
|
||||||
GasCap *uint64
|
GasCap uint64
|
||||||
TxFeeCap *float64
|
TxFeeCap float64
|
||||||
|
|
||||||
Http *APIConfig
|
Http *APIConfig
|
||||||
Ws *APIConfig
|
Ws *APIConfig
|
||||||
|
|
@ -142,74 +118,74 @@ type JsonRPCConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type APIConfig struct {
|
type APIConfig struct {
|
||||||
Enabled *bool
|
Enabled bool
|
||||||
Port *uint64
|
Port uint64
|
||||||
Prefix *string
|
Prefix string
|
||||||
Host *string
|
Host string
|
||||||
}
|
}
|
||||||
|
|
||||||
type GpoConfig struct {
|
type GpoConfig struct {
|
||||||
Blocks *uint64
|
Blocks uint64
|
||||||
Percentile *uint64
|
Percentile uint64
|
||||||
MaxPrice *big.Int
|
MaxPrice *big.Int
|
||||||
IgnorePrice *big.Int
|
IgnorePrice *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetricsConfig struct {
|
type MetricsConfig struct {
|
||||||
Enabled *bool
|
Enabled bool
|
||||||
Expensive *bool
|
Expensive bool
|
||||||
InfluxDB *InfluxDBConfig
|
InfluxDB *InfluxDBConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type InfluxDBConfig struct {
|
type InfluxDBConfig struct {
|
||||||
V1Enabled *bool
|
V1Enabled bool
|
||||||
Endpoint *string
|
Endpoint string
|
||||||
Database *string
|
Database string
|
||||||
Username *string
|
Username string
|
||||||
Password *string
|
Password string
|
||||||
Tags *map[string]string
|
Tags map[string]string
|
||||||
V2Enabled *bool
|
V2Enabled bool
|
||||||
Token *string
|
Token string
|
||||||
Bucket *string
|
Bucket string
|
||||||
Organization *string
|
Organization string
|
||||||
}
|
}
|
||||||
|
|
||||||
type CacheConfig struct {
|
type CacheConfig struct {
|
||||||
Cache *uint64
|
Cache uint64
|
||||||
PercGc *uint64
|
PercGc uint64
|
||||||
PercSnapshot *uint64
|
PercSnapshot uint64
|
||||||
PercDatabase *uint64
|
PercDatabase uint64
|
||||||
PercTrie *uint64
|
PercTrie uint64
|
||||||
Journal *string
|
Journal string
|
||||||
Rejournal *time.Duration
|
Rejournal time.Duration
|
||||||
NoPrefetch *bool
|
NoPrefetch bool
|
||||||
Preimages *bool
|
Preimages bool
|
||||||
TxLookupLimit *uint64
|
TxLookupLimit uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type AccountsConfig struct {
|
type AccountsConfig struct {
|
||||||
Unlock []string
|
Unlock []string
|
||||||
PasswordFile *string
|
PasswordFile string
|
||||||
AllowInsecureUnlock *bool
|
AllowInsecureUnlock bool
|
||||||
UseLightweightKDF *bool
|
UseLightweightKDF bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
Chain: stringPtr("mainnet"),
|
Chain: "mainnet",
|
||||||
Debug: boolPtr(false),
|
Debug: false,
|
||||||
Whitelist: mapStrPtr(map[string]string{}),
|
Whitelist: map[string]string{},
|
||||||
LogLevel: stringPtr("INFO"),
|
LogLevel: "INFO",
|
||||||
DataDir: stringPtr(defaultDataDir()),
|
DataDir: defaultDataDir(),
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
MaxPeers: uint64Ptr(30),
|
MaxPeers: 30,
|
||||||
MaxPendPeers: uint64Ptr(50),
|
MaxPendPeers: 50,
|
||||||
Bind: stringPtr("0.0.0.0"),
|
Bind: "0.0.0.0",
|
||||||
Port: uint64Ptr(30303),
|
Port: 30303,
|
||||||
NoDiscover: boolPtr(false),
|
NoDiscover: false,
|
||||||
NAT: stringPtr("any"),
|
NAT: "any",
|
||||||
Discovery: &P2PDiscovery{
|
Discovery: &P2PDiscovery{
|
||||||
V5Enabled: boolPtr(false),
|
V5Enabled: false,
|
||||||
Bootnodes: []string{},
|
Bootnodes: []string{},
|
||||||
BootnodesV4: []string{},
|
BootnodesV4: []string{},
|
||||||
BootnodesV5: []string{},
|
BootnodesV5: []string{},
|
||||||
|
|
@ -219,97 +195,97 @@ func DefaultConfig() *Config {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Heimdall: &HeimdallConfig{
|
Heimdall: &HeimdallConfig{
|
||||||
URL: stringPtr("http://localhost:1317"),
|
URL: "http://localhost:1317",
|
||||||
Without: boolPtr(false),
|
Without: false,
|
||||||
},
|
},
|
||||||
SyncMode: stringPtr("fast"),
|
SyncMode: "fast",
|
||||||
GcMode: stringPtr("full"),
|
GcMode: "full",
|
||||||
Snapshot: boolPtr(true),
|
Snapshot: true,
|
||||||
EthStats: stringPtr(""),
|
EthStats: "",
|
||||||
TxPool: &TxPoolConfig{
|
TxPool: &TxPoolConfig{
|
||||||
Locals: []string{},
|
Locals: []string{},
|
||||||
NoLocals: boolPtr(false),
|
NoLocals: false,
|
||||||
Journal: stringPtr(""),
|
Journal: "",
|
||||||
Rejournal: durPtr(1 * time.Hour),
|
Rejournal: time.Duration(1 * time.Hour),
|
||||||
PriceLimit: uint64Ptr(1),
|
PriceLimit: 1,
|
||||||
PriceBump: uint64Ptr(10),
|
PriceBump: 10,
|
||||||
AccountSlots: uint64Ptr(16),
|
AccountSlots: 16,
|
||||||
GlobalSlots: uint64Ptr(4096),
|
GlobalSlots: 4096,
|
||||||
AccountQueue: uint64Ptr(64),
|
AccountQueue: 64,
|
||||||
GlobalQueue: uint64Ptr(1024),
|
GlobalQueue: 1024,
|
||||||
LifeTime: durPtr(3 * time.Hour),
|
LifeTime: time.Duration(3 * time.Hour),
|
||||||
},
|
},
|
||||||
Sealer: &SealerConfig{
|
Sealer: &SealerConfig{
|
||||||
Enabled: boolPtr(false),
|
Enabled: false,
|
||||||
Etherbase: stringPtr(""),
|
Etherbase: "",
|
||||||
GasCeil: uint64Ptr(8000000),
|
GasCeil: 8000000,
|
||||||
GasPrice: big.NewInt(params.GWei),
|
GasPrice: big.NewInt(params.GWei),
|
||||||
ExtraData: stringPtr(""),
|
ExtraData: "",
|
||||||
},
|
},
|
||||||
Gpo: &GpoConfig{
|
Gpo: &GpoConfig{
|
||||||
Blocks: uint64Ptr(20),
|
Blocks: 20,
|
||||||
Percentile: uint64Ptr(60),
|
Percentile: 60,
|
||||||
MaxPrice: gasprice.DefaultMaxPrice,
|
MaxPrice: gasprice.DefaultMaxPrice,
|
||||||
IgnorePrice: gasprice.DefaultIgnorePrice,
|
IgnorePrice: gasprice.DefaultIgnorePrice,
|
||||||
},
|
},
|
||||||
JsonRPC: &JsonRPCConfig{
|
JsonRPC: &JsonRPCConfig{
|
||||||
IPCDisable: boolPtr(false),
|
IPCDisable: false,
|
||||||
IPCPath: stringPtr(""),
|
IPCPath: "",
|
||||||
Modules: []string{"web3", "net"},
|
Modules: []string{"web3", "net"},
|
||||||
Cors: []string{"*"},
|
Cors: []string{"*"},
|
||||||
VHost: []string{"*"},
|
VHost: []string{"*"},
|
||||||
GasCap: uint64Ptr(ethconfig.Defaults.RPCGasCap),
|
GasCap: ethconfig.Defaults.RPCGasCap,
|
||||||
TxFeeCap: float64Ptr(ethconfig.Defaults.RPCTxFeeCap),
|
TxFeeCap: ethconfig.Defaults.RPCTxFeeCap,
|
||||||
Http: &APIConfig{
|
Http: &APIConfig{
|
||||||
Enabled: boolPtr(false),
|
Enabled: false,
|
||||||
Port: uint64Ptr(8545),
|
Port: 8545,
|
||||||
Prefix: stringPtr(""),
|
Prefix: "",
|
||||||
Host: stringPtr("localhost"),
|
Host: "localhost",
|
||||||
},
|
},
|
||||||
Ws: &APIConfig{
|
Ws: &APIConfig{
|
||||||
Enabled: boolPtr(false),
|
Enabled: false,
|
||||||
Port: uint64Ptr(8546),
|
Port: 8546,
|
||||||
Prefix: stringPtr(""),
|
Prefix: "",
|
||||||
Host: stringPtr("localhost"),
|
Host: "localhost",
|
||||||
},
|
},
|
||||||
Graphql: &APIConfig{
|
Graphql: &APIConfig{
|
||||||
Enabled: boolPtr(false),
|
Enabled: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Ethstats: stringPtr(""),
|
Ethstats: "",
|
||||||
Metrics: &MetricsConfig{
|
Metrics: &MetricsConfig{
|
||||||
Enabled: boolPtr(false),
|
Enabled: false,
|
||||||
Expensive: boolPtr(false),
|
Expensive: false,
|
||||||
InfluxDB: &InfluxDBConfig{
|
InfluxDB: &InfluxDBConfig{
|
||||||
V1Enabled: boolPtr(false),
|
V1Enabled: false,
|
||||||
Endpoint: stringPtr(""),
|
Endpoint: "",
|
||||||
Database: stringPtr(""),
|
Database: "",
|
||||||
Username: stringPtr(""),
|
Username: "",
|
||||||
Password: stringPtr(""),
|
Password: "",
|
||||||
Tags: mapStrPtr(map[string]string{}),
|
Tags: map[string]string{},
|
||||||
V2Enabled: boolPtr(false),
|
V2Enabled: false,
|
||||||
Token: stringPtr(""),
|
Token: "",
|
||||||
Bucket: stringPtr(""),
|
Bucket: "",
|
||||||
Organization: stringPtr(""),
|
Organization: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Cache: &CacheConfig{
|
Cache: &CacheConfig{
|
||||||
Cache: uint64Ptr(1024),
|
Cache: 1024,
|
||||||
PercDatabase: uint64Ptr(50),
|
PercDatabase: 50,
|
||||||
PercTrie: uint64Ptr(15),
|
PercTrie: 15,
|
||||||
PercGc: uint64Ptr(25),
|
PercGc: 25,
|
||||||
PercSnapshot: uint64Ptr(10),
|
PercSnapshot: 10,
|
||||||
Journal: stringPtr("triecache"),
|
Journal: "triecache",
|
||||||
Rejournal: durPtr(60 * time.Minute),
|
Rejournal: 60 * time.Minute,
|
||||||
NoPrefetch: boolPtr(false),
|
NoPrefetch: false,
|
||||||
Preimages: boolPtr(false),
|
Preimages: false,
|
||||||
TxLookupLimit: uint64Ptr(2350000),
|
TxLookupLimit: 2350000,
|
||||||
},
|
},
|
||||||
Accounts: &AccountsConfig{
|
Accounts: &AccountsConfig{
|
||||||
Unlock: []string{},
|
Unlock: []string{},
|
||||||
PasswordFile: stringPtr(""),
|
PasswordFile: "",
|
||||||
AllowInsecureUnlock: boolPtr(false),
|
AllowInsecureUnlock: false,
|
||||||
UseLightweightKDF: boolPtr(false),
|
UseLightweightKDF: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -330,9 +306,9 @@ func readConfigFile(path string) (*Config, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) loadChain() error {
|
func (c *Config) loadChain() error {
|
||||||
chain, ok := chains.GetChain(*c.Chain)
|
chain, ok := chains.GetChain(c.Chain)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("chain '%s' not found", *c.Chain)
|
return fmt.Errorf("chain '%s' not found", c.Chain)
|
||||||
}
|
}
|
||||||
c.chain = chain
|
c.chain = chain
|
||||||
|
|
||||||
|
|
@ -342,10 +318,10 @@ func (c *Config) loadChain() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// depending on the chain we have different cache values
|
// depending on the chain we have different cache values
|
||||||
if *c.Chain != "mainnet" {
|
if c.Chain != "mainnet" {
|
||||||
c.Cache.Cache = uint64Ptr(4096)
|
c.Cache.Cache = 4096
|
||||||
} else {
|
} else {
|
||||||
c.Cache.Cache = uint64Ptr(1024)
|
c.Cache.Cache = 1024
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -358,30 +334,30 @@ func (c *Config) buildEth() (*ethconfig.Config, error) {
|
||||||
n := ethconfig.Defaults
|
n := ethconfig.Defaults
|
||||||
n.NetworkId = c.chain.NetworkId
|
n.NetworkId = c.chain.NetworkId
|
||||||
n.Genesis = c.chain.Genesis
|
n.Genesis = c.chain.Genesis
|
||||||
n.HeimdallURL = *c.Heimdall.URL
|
n.HeimdallURL = c.Heimdall.URL
|
||||||
n.WithoutHeimdall = *c.Heimdall.Without
|
n.WithoutHeimdall = c.Heimdall.Without
|
||||||
|
|
||||||
// txpool options
|
// txpool options
|
||||||
{
|
{
|
||||||
n.TxPool.NoLocals = *c.TxPool.NoLocals
|
n.TxPool.NoLocals = c.TxPool.NoLocals
|
||||||
n.TxPool.Journal = *c.TxPool.Journal
|
n.TxPool.Journal = c.TxPool.Journal
|
||||||
n.TxPool.Rejournal = *c.TxPool.Rejournal
|
n.TxPool.Rejournal = c.TxPool.Rejournal
|
||||||
n.TxPool.PriceLimit = *c.TxPool.PriceLimit
|
n.TxPool.PriceLimit = c.TxPool.PriceLimit
|
||||||
n.TxPool.PriceBump = *c.TxPool.PriceBump
|
n.TxPool.PriceBump = c.TxPool.PriceBump
|
||||||
n.TxPool.AccountSlots = *c.TxPool.AccountSlots
|
n.TxPool.AccountSlots = c.TxPool.AccountSlots
|
||||||
n.TxPool.GlobalSlots = *c.TxPool.GlobalSlots
|
n.TxPool.GlobalSlots = c.TxPool.GlobalSlots
|
||||||
n.TxPool.AccountQueue = *c.TxPool.AccountQueue
|
n.TxPool.AccountQueue = c.TxPool.AccountQueue
|
||||||
n.TxPool.GlobalQueue = *c.TxPool.GlobalQueue
|
n.TxPool.GlobalQueue = c.TxPool.GlobalQueue
|
||||||
n.TxPool.Lifetime = *c.TxPool.LifeTime
|
n.TxPool.Lifetime = c.TxPool.LifeTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// miner options
|
// miner options
|
||||||
{
|
{
|
||||||
n.Miner.GasPrice = c.Sealer.GasPrice
|
n.Miner.GasPrice = c.Sealer.GasPrice
|
||||||
n.Miner.GasCeil = *c.Sealer.GasCeil
|
n.Miner.GasCeil = c.Sealer.GasCeil
|
||||||
n.Miner.ExtraData = []byte(*c.Sealer.ExtraData)
|
n.Miner.ExtraData = []byte(c.Sealer.ExtraData)
|
||||||
|
|
||||||
if etherbase := *c.Sealer.Etherbase; etherbase != "" {
|
if etherbase := c.Sealer.Etherbase; etherbase != "" {
|
||||||
if !common.IsHexAddress(etherbase) {
|
if !common.IsHexAddress(etherbase) {
|
||||||
return nil, fmt.Errorf("etherbase is not an address: %s", etherbase)
|
return nil, fmt.Errorf("etherbase is not an address: %s", etherbase)
|
||||||
}
|
}
|
||||||
|
|
@ -398,7 +374,7 @@ func (c *Config) buildEth() (*ethconfig.Config, error) {
|
||||||
// whitelist
|
// whitelist
|
||||||
{
|
{
|
||||||
n.Whitelist = map[uint64]common.Hash{}
|
n.Whitelist = map[uint64]common.Hash{}
|
||||||
for k, v := range *c.Whitelist {
|
for k, v := range c.Whitelist {
|
||||||
number, err := strconv.ParseUint(k, 0, 64)
|
number, err := strconv.ParseUint(k, 0, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid whitelist block number %s: %v", k, err)
|
return nil, fmt.Errorf("invalid whitelist block number %s: %v", k, err)
|
||||||
|
|
@ -413,9 +389,9 @@ func (c *Config) buildEth() (*ethconfig.Config, error) {
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
{
|
{
|
||||||
cache := *c.Cache.Cache
|
cache := c.Cache.Cache
|
||||||
calcPerc := func(val *uint64) int {
|
calcPerc := func(val uint64) int {
|
||||||
return int(cache * (*val) / 100)
|
return int(cache * (val) / 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cap the cache allowance
|
// Cap the cache allowance
|
||||||
|
|
@ -437,28 +413,28 @@ func (c *Config) buildEth() (*ethconfig.Config, error) {
|
||||||
log.Debug("Sanitizing Go's GC trigger", "percent", int(gogc))
|
log.Debug("Sanitizing Go's GC trigger", "percent", int(gogc))
|
||||||
godebug.SetGCPercent(int(gogc))
|
godebug.SetGCPercent(int(gogc))
|
||||||
|
|
||||||
n.TrieCleanCacheJournal = *c.Cache.Journal
|
n.TrieCleanCacheJournal = c.Cache.Journal
|
||||||
n.TrieCleanCacheRejournal = *c.Cache.Rejournal
|
n.TrieCleanCacheRejournal = c.Cache.Rejournal
|
||||||
n.DatabaseCache = calcPerc(c.Cache.PercDatabase)
|
n.DatabaseCache = calcPerc(c.Cache.PercDatabase)
|
||||||
n.SnapshotCache = calcPerc(c.Cache.PercSnapshot)
|
n.SnapshotCache = calcPerc(c.Cache.PercSnapshot)
|
||||||
n.TrieCleanCache = calcPerc(c.Cache.PercTrie)
|
n.TrieCleanCache = calcPerc(c.Cache.PercTrie)
|
||||||
n.TrieDirtyCache = calcPerc(c.Cache.PercGc)
|
n.TrieDirtyCache = calcPerc(c.Cache.PercGc)
|
||||||
n.NoPrefetch = *c.Cache.NoPrefetch
|
n.NoPrefetch = c.Cache.NoPrefetch
|
||||||
n.Preimages = *c.Cache.Preimages
|
n.Preimages = c.Cache.Preimages
|
||||||
n.TxLookupLimit = *c.Cache.TxLookupLimit
|
n.TxLookupLimit = c.Cache.TxLookupLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
n.RPCGasCap = *c.JsonRPC.GasCap
|
n.RPCGasCap = c.JsonRPC.GasCap
|
||||||
if n.RPCGasCap != 0 {
|
if n.RPCGasCap != 0 {
|
||||||
log.Info("Set global gas cap", "cap", n.RPCGasCap)
|
log.Info("Set global gas cap", "cap", n.RPCGasCap)
|
||||||
} else {
|
} else {
|
||||||
log.Info("Global gas cap disabled")
|
log.Info("Global gas cap disabled")
|
||||||
}
|
}
|
||||||
n.RPCTxFeeCap = *c.JsonRPC.TxFeeCap
|
n.RPCTxFeeCap = c.JsonRPC.TxFeeCap
|
||||||
|
|
||||||
// sync mode. It can either be "fast", "full" or "snap". We disable
|
// sync mode. It can either be "fast", "full" or "snap". We disable
|
||||||
// for now the "light" mode.
|
// for now the "light" mode.
|
||||||
switch *c.SyncMode {
|
switch c.SyncMode {
|
||||||
case "fast":
|
case "fast":
|
||||||
n.SyncMode = downloader.FastSync
|
n.SyncMode = downloader.FastSync
|
||||||
case "full":
|
case "full":
|
||||||
|
|
@ -466,11 +442,11 @@ func (c *Config) buildEth() (*ethconfig.Config, error) {
|
||||||
case "snap":
|
case "snap":
|
||||||
n.SyncMode = downloader.SnapSync
|
n.SyncMode = downloader.SnapSync
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("sync mode '%s' not found", *c.SyncMode)
|
return nil, fmt.Errorf("sync mode '%s' not found", c.SyncMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// archive mode. It can either be "archive" or "full".
|
// archive mode. It can either be "archive" or "full".
|
||||||
switch *c.GcMode {
|
switch c.GcMode {
|
||||||
case "full":
|
case "full":
|
||||||
n.NoPruning = false
|
n.NoPruning = false
|
||||||
case "archive":
|
case "archive":
|
||||||
|
|
@ -480,11 +456,11 @@ func (c *Config) buildEth() (*ethconfig.Config, error) {
|
||||||
log.Info("Enabling recording of key preimages since archive mode is used")
|
log.Info("Enabling recording of key preimages since archive mode is used")
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("gcmode '%s' not found", *c.GcMode)
|
return nil, fmt.Errorf("gcmode '%s' not found", c.GcMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// snapshot disable check
|
// snapshot disable check
|
||||||
if *c.Snapshot {
|
if c.Snapshot {
|
||||||
if n.SyncMode == downloader.SnapSync {
|
if n.SyncMode == downloader.SnapSync {
|
||||||
log.Info("Snap sync requested, enabling --snapshot")
|
log.Info("Snap sync requested, enabling --snapshot")
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -506,50 +482,50 @@ var (
|
||||||
|
|
||||||
func (c *Config) buildNode() (*node.Config, error) {
|
func (c *Config) buildNode() (*node.Config, error) {
|
||||||
ipcPath := ""
|
ipcPath := ""
|
||||||
if !*c.JsonRPC.IPCDisable {
|
if !c.JsonRPC.IPCDisable {
|
||||||
ipcPath = clientIdentifier + ".ipc"
|
ipcPath = clientIdentifier + ".ipc"
|
||||||
if *c.JsonRPC.IPCPath != "" {
|
if c.JsonRPC.IPCPath != "" {
|
||||||
ipcPath = *c.JsonRPC.IPCPath
|
ipcPath = c.JsonRPC.IPCPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := &node.Config{
|
cfg := &node.Config{
|
||||||
Name: clientIdentifier,
|
Name: clientIdentifier,
|
||||||
DataDir: *c.DataDir,
|
DataDir: c.DataDir,
|
||||||
UseLightweightKDF: *c.Accounts.UseLightweightKDF,
|
UseLightweightKDF: c.Accounts.UseLightweightKDF,
|
||||||
InsecureUnlockAllowed: *c.Accounts.AllowInsecureUnlock,
|
InsecureUnlockAllowed: c.Accounts.AllowInsecureUnlock,
|
||||||
Version: params.VersionWithCommit(gitCommit, gitDate),
|
Version: params.VersionWithCommit(gitCommit, gitDate),
|
||||||
IPCPath: ipcPath,
|
IPCPath: ipcPath,
|
||||||
P2P: p2p.Config{
|
P2P: p2p.Config{
|
||||||
MaxPeers: int(*c.P2P.MaxPeers),
|
MaxPeers: int(c.P2P.MaxPeers),
|
||||||
MaxPendingPeers: int(*c.P2P.MaxPendPeers),
|
MaxPendingPeers: int(c.P2P.MaxPendPeers),
|
||||||
ListenAddr: *c.P2P.Bind + ":" + strconv.Itoa(int(*c.P2P.Port)),
|
ListenAddr: c.P2P.Bind + ":" + strconv.Itoa(int(c.P2P.Port)),
|
||||||
DiscoveryV5: *c.P2P.Discovery.V5Enabled,
|
DiscoveryV5: c.P2P.Discovery.V5Enabled,
|
||||||
},
|
},
|
||||||
HTTPModules: c.JsonRPC.Modules,
|
HTTPModules: c.JsonRPC.Modules,
|
||||||
HTTPCors: c.JsonRPC.Cors,
|
HTTPCors: c.JsonRPC.Cors,
|
||||||
HTTPVirtualHosts: c.JsonRPC.VHost,
|
HTTPVirtualHosts: c.JsonRPC.VHost,
|
||||||
HTTPPathPrefix: *c.JsonRPC.Http.Prefix,
|
HTTPPathPrefix: c.JsonRPC.Http.Prefix,
|
||||||
WSModules: c.JsonRPC.Modules,
|
WSModules: c.JsonRPC.Modules,
|
||||||
WSOrigins: c.JsonRPC.Cors,
|
WSOrigins: c.JsonRPC.Cors,
|
||||||
WSPathPrefix: *c.JsonRPC.Ws.Prefix,
|
WSPathPrefix: c.JsonRPC.Ws.Prefix,
|
||||||
GraphQLCors: c.JsonRPC.Cors,
|
GraphQLCors: c.JsonRPC.Cors,
|
||||||
GraphQLVirtualHosts: c.JsonRPC.VHost,
|
GraphQLVirtualHosts: c.JsonRPC.VHost,
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable jsonrpc endpoints
|
// enable jsonrpc endpoints
|
||||||
{
|
{
|
||||||
if *c.JsonRPC.Http.Enabled {
|
if c.JsonRPC.Http.Enabled {
|
||||||
cfg.HTTPHost = *c.JsonRPC.Http.Host
|
cfg.HTTPHost = c.JsonRPC.Http.Host
|
||||||
cfg.HTTPPort = int(*c.JsonRPC.Http.Port)
|
cfg.HTTPPort = int(c.JsonRPC.Http.Port)
|
||||||
}
|
}
|
||||||
if *c.JsonRPC.Ws.Enabled {
|
if c.JsonRPC.Ws.Enabled {
|
||||||
cfg.WSHost = *c.JsonRPC.Ws.Host
|
cfg.WSHost = c.JsonRPC.Ws.Host
|
||||||
cfg.WSPort = int(*c.JsonRPC.Ws.Port)
|
cfg.WSPort = int(c.JsonRPC.Ws.Port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
natif, err := nat.Parse(*c.P2P.NAT)
|
natif, err := nat.Parse(c.P2P.NAT)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("wrong 'nat' flag: %v", err)
|
return nil, fmt.Errorf("wrong 'nat' flag: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -574,7 +550,7 @@ func (c *Config) buildNode() (*node.Config, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if *c.P2P.NoDiscover {
|
if c.P2P.NoDiscover {
|
||||||
// Disable networking, for now, we will not even allow incomming connections
|
// Disable networking, for now, we will not even allow incomming connections
|
||||||
cfg.P2P.MaxPeers = 0
|
cfg.P2P.MaxPeers = 0
|
||||||
cfg.P2P.NoDiscovery = true
|
cfg.P2P.NoDiscovery = true
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
@ -20,11 +21,14 @@ func TestConfigDefault(t *testing.T) {
|
||||||
|
|
||||||
func TestConfigMerge(t *testing.T) {
|
func TestConfigMerge(t *testing.T) {
|
||||||
c0 := &Config{
|
c0 := &Config{
|
||||||
Chain: stringPtr("0"),
|
Chain: "0",
|
||||||
Debug: boolPtr(false),
|
Debug: true,
|
||||||
Whitelist: mapStrPtr(map[string]string{
|
Whitelist: map[string]string{
|
||||||
"a": "b",
|
"a": "b",
|
||||||
}),
|
},
|
||||||
|
TxPool: &TxPoolConfig{
|
||||||
|
LifeTime: 5 * time.Second,
|
||||||
|
},
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
Discovery: &P2PDiscovery{
|
Discovery: &P2PDiscovery{
|
||||||
StaticNodes: []string{
|
StaticNodes: []string{
|
||||||
|
|
@ -34,11 +38,12 @@ func TestConfigMerge(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
c1 := &Config{
|
c1 := &Config{
|
||||||
Chain: stringPtr("1"),
|
Chain: "1",
|
||||||
Whitelist: mapStrPtr(map[string]string{
|
Whitelist: map[string]string{
|
||||||
"b": "c",
|
"b": "c",
|
||||||
}),
|
},
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
|
MaxPeers: 10,
|
||||||
Discovery: &P2PDiscovery{
|
Discovery: &P2PDiscovery{
|
||||||
StaticNodes: []string{
|
StaticNodes: []string{
|
||||||
"b",
|
"b",
|
||||||
|
|
@ -47,13 +52,17 @@ func TestConfigMerge(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
expected := &Config{
|
expected := &Config{
|
||||||
Chain: stringPtr("1"),
|
Chain: "1",
|
||||||
Debug: boolPtr(false),
|
Debug: true,
|
||||||
Whitelist: mapStrPtr(map[string]string{
|
Whitelist: map[string]string{
|
||||||
"a": "b",
|
"a": "b",
|
||||||
"b": "c",
|
"b": "c",
|
||||||
}),
|
},
|
||||||
|
TxPool: &TxPoolConfig{
|
||||||
|
LifeTime: 5 * time.Second,
|
||||||
|
},
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
|
MaxPeers: 10,
|
||||||
Discovery: &P2PDiscovery{
|
Discovery: &P2PDiscovery{
|
||||||
StaticNodes: []string{
|
StaticNodes: []string{
|
||||||
"a",
|
"a",
|
||||||
|
|
|
||||||
|
|
@ -12,22 +12,22 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
Usage: "Path of the file to apply",
|
Usage: "Path of the file to apply",
|
||||||
Value: c.cliConfig.Debug,
|
Value: &c.cliConfig.Debug,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "chain",
|
Name: "chain",
|
||||||
Usage: "Name of the chain to sync",
|
Usage: "Name of the chain to sync",
|
||||||
Value: c.cliConfig.Chain,
|
Value: &c.cliConfig.Chain,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "log-level",
|
Name: "log-level",
|
||||||
Usage: "Set log level for the server",
|
Usage: "Set log level for the server",
|
||||||
Value: c.cliConfig.LogLevel,
|
Value: &c.cliConfig.LogLevel,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "datadir",
|
Name: "datadir",
|
||||||
Usage: "Path of the data directory to store information",
|
Usage: "Path of the data directory to store information",
|
||||||
Value: c.cliConfig.DataDir,
|
Value: &c.cliConfig.DataDir,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "config",
|
Name: "config",
|
||||||
|
|
@ -37,34 +37,34 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "syncmode",
|
Name: "syncmode",
|
||||||
Usage: `Blockchain sync mode ("fast", "full", "snap" or "light")`,
|
Usage: `Blockchain sync mode ("fast", "full", "snap" or "light")`,
|
||||||
Value: c.cliConfig.SyncMode,
|
Value: &c.cliConfig.SyncMode,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "gcmode",
|
Name: "gcmode",
|
||||||
Usage: `Blockchain garbage collection mode ("full", "archive")`,
|
Usage: `Blockchain garbage collection mode ("full", "archive")`,
|
||||||
Value: c.cliConfig.GcMode,
|
Value: &c.cliConfig.GcMode,
|
||||||
})
|
})
|
||||||
f.MapStringFlag(&flagset.MapStringFlag{
|
f.MapStringFlag(&flagset.MapStringFlag{
|
||||||
Name: "whitelist",
|
Name: "whitelist",
|
||||||
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
||||||
Value: c.cliConfig.Whitelist,
|
Value: &c.cliConfig.Whitelist,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "snapshot",
|
Name: "snapshot",
|
||||||
Usage: `Enables snapshot-database mode (default = enable)`,
|
Usage: `Enables snapshot-database mode (default = enable)`,
|
||||||
Value: c.cliConfig.Snapshot,
|
Value: &c.cliConfig.Snapshot,
|
||||||
})
|
})
|
||||||
|
|
||||||
// heimdall
|
// heimdall
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "bor.heimdall",
|
Name: "bor.heimdall",
|
||||||
Usage: "URL of Heimdall service",
|
Usage: "URL of Heimdall service",
|
||||||
Value: c.cliConfig.Heimdall.URL,
|
Value: &c.cliConfig.Heimdall.URL,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "bor.withoutheimdall",
|
Name: "bor.withoutheimdall",
|
||||||
Usage: "Run without Heimdall service (for testing purpose)",
|
Usage: "Run without Heimdall service (for testing purpose)",
|
||||||
Value: c.cliConfig.Heimdall.Without,
|
Value: &c.cliConfig.Heimdall.Without,
|
||||||
})
|
})
|
||||||
|
|
||||||
// txpool options
|
// txpool options
|
||||||
|
|
@ -76,74 +76,74 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "txpool.nolocals",
|
Name: "txpool.nolocals",
|
||||||
Usage: "Disables price exemptions for locally submitted transactions",
|
Usage: "Disables price exemptions for locally submitted transactions",
|
||||||
Value: c.cliConfig.TxPool.NoLocals,
|
Value: &c.cliConfig.TxPool.NoLocals,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "txpool.journal",
|
Name: "txpool.journal",
|
||||||
Usage: "Disk journal for local transaction to survive node restarts",
|
Usage: "Disk journal for local transaction to survive node restarts",
|
||||||
Value: c.cliConfig.TxPool.Journal,
|
Value: &c.cliConfig.TxPool.Journal,
|
||||||
})
|
})
|
||||||
f.DurationFlag(&flagset.DurationFlag{
|
f.DurationFlag(&flagset.DurationFlag{
|
||||||
Name: "txpool.rejournal",
|
Name: "txpool.rejournal",
|
||||||
Usage: "Time interval to regenerate the local transaction journal",
|
Usage: "Time interval to regenerate the local transaction journal",
|
||||||
Value: c.cliConfig.TxPool.Rejournal,
|
Value: &c.cliConfig.TxPool.Rejournal,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txpool.pricelimit",
|
Name: "txpool.pricelimit",
|
||||||
Usage: "Minimum gas price limit to enforce for acceptance into the pool",
|
Usage: "Minimum gas price limit to enforce for acceptance into the pool",
|
||||||
Value: c.cliConfig.TxPool.PriceLimit,
|
Value: &c.cliConfig.TxPool.PriceLimit,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txpool.pricebump",
|
Name: "txpool.pricebump",
|
||||||
Usage: "Price bump percentage to replace an already existing transaction",
|
Usage: "Price bump percentage to replace an already existing transaction",
|
||||||
Value: c.cliConfig.TxPool.PriceBump,
|
Value: &c.cliConfig.TxPool.PriceBump,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txpool.accountslots",
|
Name: "txpool.accountslots",
|
||||||
Usage: "Minimum number of executable transaction slots guaranteed per account",
|
Usage: "Minimum number of executable transaction slots guaranteed per account",
|
||||||
Value: c.cliConfig.TxPool.AccountSlots,
|
Value: &c.cliConfig.TxPool.AccountSlots,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txpool.globalslots",
|
Name: "txpool.globalslots",
|
||||||
Usage: "Maximum number of executable transaction slots for all accounts",
|
Usage: "Maximum number of executable transaction slots for all accounts",
|
||||||
Value: c.cliConfig.TxPool.GlobalSlots,
|
Value: &c.cliConfig.TxPool.GlobalSlots,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txpool.accountqueue",
|
Name: "txpool.accountqueue",
|
||||||
Usage: "Maximum number of non-executable transaction slots permitted per account",
|
Usage: "Maximum number of non-executable transaction slots permitted per account",
|
||||||
Value: c.cliConfig.TxPool.AccountQueue,
|
Value: &c.cliConfig.TxPool.AccountQueue,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txpool.globalqueue",
|
Name: "txpool.globalqueue",
|
||||||
Usage: "Maximum number of non-executable transaction slots for all accounts",
|
Usage: "Maximum number of non-executable transaction slots for all accounts",
|
||||||
Value: c.cliConfig.TxPool.GlobalQueue,
|
Value: &c.cliConfig.TxPool.GlobalQueue,
|
||||||
})
|
})
|
||||||
f.DurationFlag(&flagset.DurationFlag{
|
f.DurationFlag(&flagset.DurationFlag{
|
||||||
Name: "txpool.lifetime",
|
Name: "txpool.lifetime",
|
||||||
Usage: "Maximum amount of time non-executable transaction are queued",
|
Usage: "Maximum amount of time non-executable transaction are queued",
|
||||||
Value: c.cliConfig.TxPool.LifeTime,
|
Value: &c.cliConfig.TxPool.LifeTime,
|
||||||
})
|
})
|
||||||
|
|
||||||
// sealer options
|
// sealer options
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "mine",
|
Name: "mine",
|
||||||
Usage: "Enable mining",
|
Usage: "Enable mining",
|
||||||
Value: c.cliConfig.Sealer.Enabled,
|
Value: &c.cliConfig.Sealer.Enabled,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "miner.etherbase",
|
Name: "miner.etherbase",
|
||||||
Usage: "Public address for block mining rewards (default = first account)",
|
Usage: "Public address for block mining rewards (default = first account)",
|
||||||
Value: c.cliConfig.Sealer.Etherbase,
|
Value: &c.cliConfig.Sealer.Etherbase,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "miner.extradata",
|
Name: "miner.extradata",
|
||||||
Usage: "Block extra data set by the miner (default = client version)",
|
Usage: "Block extra data set by the miner (default = client version)",
|
||||||
Value: c.cliConfig.Sealer.ExtraData,
|
Value: &c.cliConfig.Sealer.ExtraData,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "miner.gaslimit",
|
Name: "miner.gaslimit",
|
||||||
Usage: "Target gas ceiling for mined blocks",
|
Usage: "Target gas ceiling for mined blocks",
|
||||||
Value: c.cliConfig.Sealer.GasCeil,
|
Value: &c.cliConfig.Sealer.GasCeil,
|
||||||
})
|
})
|
||||||
f.BigIntFlag(&flagset.BigIntFlag{
|
f.BigIntFlag(&flagset.BigIntFlag{
|
||||||
Name: "miner.gasprice",
|
Name: "miner.gasprice",
|
||||||
|
|
@ -155,19 +155,19 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "ethstats",
|
Name: "ethstats",
|
||||||
Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
|
Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
|
||||||
Value: c.cliConfig.Ethstats,
|
Value: &c.cliConfig.Ethstats,
|
||||||
})
|
})
|
||||||
|
|
||||||
// gas price oracle
|
// gas price oracle
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "gpo.blocks",
|
Name: "gpo.blocks",
|
||||||
Usage: "Number of recent blocks to check for gas prices",
|
Usage: "Number of recent blocks to check for gas prices",
|
||||||
Value: c.cliConfig.Gpo.Blocks,
|
Value: &c.cliConfig.Gpo.Blocks,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "gpo.percentile",
|
Name: "gpo.percentile",
|
||||||
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices",
|
Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices",
|
||||||
Value: c.cliConfig.Gpo.Percentile,
|
Value: &c.cliConfig.Gpo.Percentile,
|
||||||
})
|
})
|
||||||
f.BigIntFlag(&flagset.BigIntFlag{
|
f.BigIntFlag(&flagset.BigIntFlag{
|
||||||
Name: "gpo.maxprice",
|
Name: "gpo.maxprice",
|
||||||
|
|
@ -184,74 +184,74 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "cache",
|
Name: "cache",
|
||||||
Usage: "Megabytes of memory allocated to internal caching (default = 4096 mainnet full node)",
|
Usage: "Megabytes of memory allocated to internal caching (default = 4096 mainnet full node)",
|
||||||
Value: c.cliConfig.Cache.Cache,
|
Value: &c.cliConfig.Cache.Cache,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "cache.database",
|
Name: "cache.database",
|
||||||
Usage: "Percentage of cache memory allowance to use for database io",
|
Usage: "Percentage of cache memory allowance to use for database io",
|
||||||
Value: c.cliConfig.Cache.PercDatabase,
|
Value: &c.cliConfig.Cache.PercDatabase,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "cache.trie",
|
Name: "cache.trie",
|
||||||
Usage: "Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode)",
|
Usage: "Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode)",
|
||||||
Value: c.cliConfig.Cache.PercTrie,
|
Value: &c.cliConfig.Cache.PercTrie,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "cache.trie.journal",
|
Name: "cache.trie.journal",
|
||||||
Usage: "Disk journal directory for trie cache to survive node restarts",
|
Usage: "Disk journal directory for trie cache to survive node restarts",
|
||||||
Value: c.cliConfig.Cache.Journal,
|
Value: &c.cliConfig.Cache.Journal,
|
||||||
})
|
})
|
||||||
f.DurationFlag(&flagset.DurationFlag{
|
f.DurationFlag(&flagset.DurationFlag{
|
||||||
Name: "cache.trie.rejournal",
|
Name: "cache.trie.rejournal",
|
||||||
Usage: "Time interval to regenerate the trie cache journal",
|
Usage: "Time interval to regenerate the trie cache journal",
|
||||||
Value: c.cliConfig.Cache.Rejournal,
|
Value: &c.cliConfig.Cache.Rejournal,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "cache.gc",
|
Name: "cache.gc",
|
||||||
Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)",
|
Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)",
|
||||||
Value: c.cliConfig.Cache.PercGc,
|
Value: &c.cliConfig.Cache.PercGc,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "cache.snapshot",
|
Name: "cache.snapshot",
|
||||||
Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)",
|
Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)",
|
||||||
Value: c.cliConfig.Cache.PercSnapshot,
|
Value: &c.cliConfig.Cache.PercSnapshot,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "cache.noprefetch",
|
Name: "cache.noprefetch",
|
||||||
Usage: "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)",
|
Usage: "Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)",
|
||||||
Value: c.cliConfig.Cache.NoPrefetch,
|
Value: &c.cliConfig.Cache.NoPrefetch,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "cache.preimages",
|
Name: "cache.preimages",
|
||||||
Usage: "Enable recording the SHA3/keccak preimages of trie keys",
|
Usage: "Enable recording the SHA3/keccak preimages of trie keys",
|
||||||
Value: c.cliConfig.Cache.Preimages,
|
Value: &c.cliConfig.Cache.Preimages,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "txlookuplimit",
|
Name: "txlookuplimit",
|
||||||
Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)",
|
Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)",
|
||||||
Value: c.cliConfig.Cache.TxLookupLimit,
|
Value: &c.cliConfig.Cache.TxLookupLimit,
|
||||||
})
|
})
|
||||||
|
|
||||||
// rpc options
|
// rpc options
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "rpc.gascap",
|
Name: "rpc.gascap",
|
||||||
Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)",
|
Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)",
|
||||||
Value: c.cliConfig.JsonRPC.GasCap,
|
Value: &c.cliConfig.JsonRPC.GasCap,
|
||||||
})
|
})
|
||||||
f.Float64Flag(&flagset.Float64Flag{
|
f.Float64Flag(&flagset.Float64Flag{
|
||||||
Name: "rpc.txfeecap",
|
Name: "rpc.txfeecap",
|
||||||
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
|
Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
|
||||||
Value: c.cliConfig.JsonRPC.TxFeeCap,
|
Value: &c.cliConfig.JsonRPC.TxFeeCap,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "ipcdisable",
|
Name: "ipcdisable",
|
||||||
Usage: "Disable the IPC-RPC server",
|
Usage: "Disable the IPC-RPC server",
|
||||||
Value: c.cliConfig.JsonRPC.IPCDisable,
|
Value: &c.cliConfig.JsonRPC.IPCDisable,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "ipcpath",
|
Name: "ipcpath",
|
||||||
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
|
Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
|
||||||
Value: c.cliConfig.JsonRPC.IPCPath,
|
Value: &c.cliConfig.JsonRPC.IPCPath,
|
||||||
})
|
})
|
||||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||||
Name: "jsonrpc.corsdomain",
|
Name: "jsonrpc.corsdomain",
|
||||||
|
|
@ -264,7 +264,7 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
Value: &c.cliConfig.JsonRPC.VHost,
|
Value: &c.cliConfig.JsonRPC.VHost,
|
||||||
})
|
})
|
||||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||||
Name: "jsonrpc.modules",
|
Name: "jsonrpc.modules",
|
||||||
Usage: "API's offered over the HTTP-RPC interface",
|
Usage: "API's offered over the HTTP-RPC interface",
|
||||||
Value: &c.cliConfig.JsonRPC.Modules,
|
Value: &c.cliConfig.JsonRPC.Modules,
|
||||||
})
|
})
|
||||||
|
|
@ -273,61 +273,61 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "http",
|
Name: "http",
|
||||||
Usage: "Enable the HTTP-RPC server",
|
Usage: "Enable the HTTP-RPC server",
|
||||||
Value: c.cliConfig.JsonRPC.Http.Enabled,
|
Value: &c.cliConfig.JsonRPC.Http.Enabled,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "http.addr",
|
Name: "http.addr",
|
||||||
Usage: "HTTP-RPC server listening interface",
|
Usage: "HTTP-RPC server listening interface",
|
||||||
Value: c.cliConfig.JsonRPC.Http.Host,
|
Value: &c.cliConfig.JsonRPC.Http.Host,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "http.port",
|
Name: "http.port",
|
||||||
Usage: "HTTP-RPC server listening port",
|
Usage: "HTTP-RPC server listening port",
|
||||||
Value: c.cliConfig.JsonRPC.Http.Port,
|
Value: &c.cliConfig.JsonRPC.Http.Port,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "http.rpcprefix",
|
Name: "http.rpcprefix",
|
||||||
Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
|
Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
|
||||||
Value: c.cliConfig.JsonRPC.Http.Prefix,
|
Value: &c.cliConfig.JsonRPC.Http.Prefix,
|
||||||
})
|
})
|
||||||
// ws options
|
// ws options
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "ws",
|
Name: "ws",
|
||||||
Usage: "Enable the WS-RPC server",
|
Usage: "Enable the WS-RPC server",
|
||||||
Value: c.cliConfig.JsonRPC.Ws.Enabled,
|
Value: &c.cliConfig.JsonRPC.Ws.Enabled,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "ws.addr",
|
Name: "ws.addr",
|
||||||
Usage: "WS-RPC server listening interface",
|
Usage: "WS-RPC server listening interface",
|
||||||
Value: c.cliConfig.JsonRPC.Ws.Host,
|
Value: &c.cliConfig.JsonRPC.Ws.Host,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "ws.port",
|
Name: "ws.port",
|
||||||
Usage: "WS-RPC server listening port",
|
Usage: "WS-RPC server listening port",
|
||||||
Value: c.cliConfig.JsonRPC.Ws.Port,
|
Value: &c.cliConfig.JsonRPC.Ws.Port,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "ws.rpcprefix",
|
Name: "ws.rpcprefix",
|
||||||
Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
|
Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
|
||||||
Value: c.cliConfig.JsonRPC.Ws.Prefix,
|
Value: &c.cliConfig.JsonRPC.Ws.Prefix,
|
||||||
})
|
})
|
||||||
// graphql options
|
// graphql options
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "graphql",
|
Name: "graphql",
|
||||||
Usage: "Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.",
|
Usage: "Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.",
|
||||||
Value: c.cliConfig.JsonRPC.Graphql.Enabled,
|
Value: &c.cliConfig.JsonRPC.Graphql.Enabled,
|
||||||
})
|
})
|
||||||
|
|
||||||
// p2p options
|
// p2p options
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "bind",
|
Name: "bind",
|
||||||
Usage: "Network binding address",
|
Usage: "Network binding address",
|
||||||
Value: c.cliConfig.P2P.Bind,
|
Value: &c.cliConfig.P2P.Bind,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "port",
|
Name: "port",
|
||||||
Usage: "Network listening port",
|
Usage: "Network listening port",
|
||||||
Value: c.cliConfig.P2P.Port,
|
Value: &c.cliConfig.P2P.Port,
|
||||||
})
|
})
|
||||||
f.SliceStringFlag(&flagset.SliceStringFlag{
|
f.SliceStringFlag(&flagset.SliceStringFlag{
|
||||||
Name: "bootnodes",
|
Name: "bootnodes",
|
||||||
|
|
@ -337,90 +337,90 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "maxpeers",
|
Name: "maxpeers",
|
||||||
Usage: "Maximum number of network peers (network disabled if set to 0)",
|
Usage: "Maximum number of network peers (network disabled if set to 0)",
|
||||||
Value: c.cliConfig.P2P.MaxPeers,
|
Value: &c.cliConfig.P2P.MaxPeers,
|
||||||
})
|
})
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "maxpendpeers",
|
Name: "maxpendpeers",
|
||||||
Usage: "Maximum number of pending connection attempts (defaults used if set to 0)",
|
Usage: "Maximum number of pending connection attempts (defaults used if set to 0)",
|
||||||
Value: c.cliConfig.P2P.MaxPendPeers,
|
Value: &c.cliConfig.P2P.MaxPendPeers,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "nat",
|
Name: "nat",
|
||||||
Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)",
|
Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)",
|
||||||
Value: c.cliConfig.P2P.NAT,
|
Value: &c.cliConfig.P2P.NAT,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "nodiscover",
|
Name: "nodiscover",
|
||||||
Usage: "Disables the peer discovery mechanism (manual peer addition)",
|
Usage: "Disables the peer discovery mechanism (manual peer addition)",
|
||||||
Value: c.cliConfig.P2P.NoDiscover,
|
Value: &c.cliConfig.P2P.NoDiscover,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "v5disc",
|
Name: "v5disc",
|
||||||
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
|
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
|
||||||
Value: c.cliConfig.P2P.Discovery.V5Enabled,
|
Value: &c.cliConfig.P2P.Discovery.V5Enabled,
|
||||||
})
|
})
|
||||||
|
|
||||||
// metrics
|
// metrics
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "metrics",
|
Name: "metrics",
|
||||||
Usage: "Enable metrics collection and reporting",
|
Usage: "Enable metrics collection and reporting",
|
||||||
Value: c.cliConfig.Metrics.Enabled,
|
Value: &c.cliConfig.Metrics.Enabled,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "metrics.expensive",
|
Name: "metrics.expensive",
|
||||||
Usage: "Enable expensive metrics collection and reporting",
|
Usage: "Enable expensive metrics collection and reporting",
|
||||||
Value: c.cliConfig.Metrics.Expensive,
|
Value: &c.cliConfig.Metrics.Expensive,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "metrics.influxdb",
|
Name: "metrics.influxdb",
|
||||||
Usage: "Enable metrics export/push to an external InfluxDB database (v1)",
|
Usage: "Enable metrics export/push to an external InfluxDB database (v1)",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.V1Enabled,
|
Value: &c.cliConfig.Metrics.InfluxDB.V1Enabled,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.endpoint",
|
Name: "metrics.influxdb.endpoint",
|
||||||
Usage: "InfluxDB API endpoint to report metrics to",
|
Usage: "InfluxDB API endpoint to report metrics to",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Endpoint,
|
Value: &c.cliConfig.Metrics.InfluxDB.Endpoint,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.database",
|
Name: "metrics.influxdb.database",
|
||||||
Usage: "InfluxDB database name to push reported metrics to",
|
Usage: "InfluxDB database name to push reported metrics to",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Database,
|
Value: &c.cliConfig.Metrics.InfluxDB.Database,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.username",
|
Name: "metrics.influxdb.username",
|
||||||
Usage: "Username to authorize access to the database",
|
Usage: "Username to authorize access to the database",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Username,
|
Value: &c.cliConfig.Metrics.InfluxDB.Username,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.password",
|
Name: "metrics.influxdb.password",
|
||||||
Usage: "Password to authorize access to the database",
|
Usage: "Password to authorize access to the database",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Password,
|
Value: &c.cliConfig.Metrics.InfluxDB.Password,
|
||||||
})
|
})
|
||||||
f.MapStringFlag(&flagset.MapStringFlag{
|
f.MapStringFlag(&flagset.MapStringFlag{
|
||||||
Name: "metrics.influxdb.tags",
|
Name: "metrics.influxdb.tags",
|
||||||
Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
|
Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Tags,
|
Value: &c.cliConfig.Metrics.InfluxDB.Tags,
|
||||||
})
|
})
|
||||||
// influx db v2
|
// influx db v2
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "metrics.influxdbv2",
|
Name: "metrics.influxdbv2",
|
||||||
Usage: "Enable metrics export/push to an external InfluxDB v2 database",
|
Usage: "Enable metrics export/push to an external InfluxDB v2 database",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.V2Enabled,
|
Value: &c.cliConfig.Metrics.InfluxDB.V2Enabled,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.token",
|
Name: "metrics.influxdb.token",
|
||||||
Usage: "Token to authorize access to the database (v2 only)",
|
Usage: "Token to authorize access to the database (v2 only)",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Token,
|
Value: &c.cliConfig.Metrics.InfluxDB.Token,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.bucket",
|
Name: "metrics.influxdb.bucket",
|
||||||
Usage: "InfluxDB bucket name to push reported metrics to (v2 only)",
|
Usage: "InfluxDB bucket name to push reported metrics to (v2 only)",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Bucket,
|
Value: &c.cliConfig.Metrics.InfluxDB.Bucket,
|
||||||
})
|
})
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "metrics.influxdb.organization",
|
Name: "metrics.influxdb.organization",
|
||||||
Usage: "InfluxDB organization name (v2 only)",
|
Usage: "InfluxDB organization name (v2 only)",
|
||||||
Value: c.cliConfig.Metrics.InfluxDB.Organization,
|
Value: &c.cliConfig.Metrics.InfluxDB.Organization,
|
||||||
})
|
})
|
||||||
|
|
||||||
// account
|
// account
|
||||||
|
|
@ -432,17 +432,17 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
f.StringFlag(&flagset.StringFlag{
|
f.StringFlag(&flagset.StringFlag{
|
||||||
Name: "password",
|
Name: "password",
|
||||||
Usage: "Password file to use for non-interactive password input",
|
Usage: "Password file to use for non-interactive password input",
|
||||||
Value: c.cliConfig.Accounts.PasswordFile,
|
Value: &c.cliConfig.Accounts.PasswordFile,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "allow-insecure-unlock",
|
Name: "allow-insecure-unlock",
|
||||||
Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http",
|
Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http",
|
||||||
Value: c.cliConfig.Accounts.AllowInsecureUnlock,
|
Value: &c.cliConfig.Accounts.AllowInsecureUnlock,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "lightkdf",
|
Name: "lightkdf",
|
||||||
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
|
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
|
||||||
Value: c.cliConfig.Accounts.UseLightweightKDF,
|
Value: &c.cliConfig.Accounts.UseLightweightKDF,
|
||||||
})
|
})
|
||||||
|
|
||||||
return f
|
return f
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue