|
|
|
@ -174,20 +174,6 @@ var ( |
|
|
|
|
Name: "exitwhensynced", |
|
|
|
|
Usage: "Exits after block synchronisation completes", |
|
|
|
|
} |
|
|
|
|
UltraLightServersFlag = cli.StringFlag{ |
|
|
|
|
Name: "ulc.servers", |
|
|
|
|
Usage: "List of trusted ultra-light servers", |
|
|
|
|
Value: strings.Join(eth.DefaultConfig.UltraLightServers, ","), |
|
|
|
|
} |
|
|
|
|
UltraLightFractionFlag = cli.IntFlag{ |
|
|
|
|
Name: "ulc.fraction", |
|
|
|
|
Usage: "Minimum % of trusted ultra-light servers required to announce a new head", |
|
|
|
|
Value: eth.DefaultConfig.UltraLightFraction, |
|
|
|
|
} |
|
|
|
|
UltraLightOnlyAnnounceFlag = cli.BoolFlag{ |
|
|
|
|
Name: "ulc.onlyannounce", |
|
|
|
|
Usage: "Ultra light server sends announcements only", |
|
|
|
|
} |
|
|
|
|
IterativeOutputFlag = cli.BoolFlag{ |
|
|
|
|
Name: "iterative", |
|
|
|
|
Usage: "Print streaming JSON iteratively, delimited by newlines", |
|
|
|
@ -215,33 +201,58 @@ var ( |
|
|
|
|
Usage: `Blockchain garbage collection mode ("full", "archive")`, |
|
|
|
|
Value: "full", |
|
|
|
|
} |
|
|
|
|
LightServFlag = cli.IntFlag{ |
|
|
|
|
LightKDFFlag = cli.BoolFlag{ |
|
|
|
|
Name: "lightkdf", |
|
|
|
|
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", |
|
|
|
|
} |
|
|
|
|
WhitelistFlag = cli.StringFlag{ |
|
|
|
|
Name: "whitelist", |
|
|
|
|
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)", |
|
|
|
|
} |
|
|
|
|
// Light server and client settings
|
|
|
|
|
LightLegacyServFlag = cli.IntFlag{ // Deprecated in favor of light.serve, remove in 2021
|
|
|
|
|
Name: "lightserv", |
|
|
|
|
Usage: "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)", |
|
|
|
|
Value: eth.DefaultConfig.LightServ, |
|
|
|
|
} |
|
|
|
|
LightServeFlag = cli.IntFlag{ |
|
|
|
|
Name: "light.serve", |
|
|
|
|
Usage: "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)", |
|
|
|
|
Value: 0, |
|
|
|
|
Value: eth.DefaultConfig.LightServ, |
|
|
|
|
} |
|
|
|
|
LightBandwidthInFlag = cli.IntFlag{ |
|
|
|
|
Name: "lightbwin", |
|
|
|
|
Usage: "Incoming bandwidth limit for light server (kilobytes/sec, 0 = unlimited)", |
|
|
|
|
Value: 0, |
|
|
|
|
LightIngressFlag = cli.IntFlag{ |
|
|
|
|
Name: "light.ingress", |
|
|
|
|
Usage: "Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)", |
|
|
|
|
Value: eth.DefaultConfig.LightIngress, |
|
|
|
|
} |
|
|
|
|
LightBandwidthOutFlag = cli.IntFlag{ |
|
|
|
|
Name: "lightbwout", |
|
|
|
|
Usage: "Outgoing bandwidth limit for light server (kilobytes/sec, 0 = unlimited)", |
|
|
|
|
Value: 0, |
|
|
|
|
LightEgressFlag = cli.IntFlag{ |
|
|
|
|
Name: "light.egress", |
|
|
|
|
Usage: "Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)", |
|
|
|
|
Value: eth.DefaultConfig.LightEgress, |
|
|
|
|
} |
|
|
|
|
LightPeersFlag = cli.IntFlag{ |
|
|
|
|
LightLegacyPeersFlag = cli.IntFlag{ // Deprecated in favor of light.maxpeers, remove in 2021
|
|
|
|
|
Name: "lightpeers", |
|
|
|
|
Usage: "Maximum number of LES client peers", |
|
|
|
|
Usage: "Maximum number of light clients to serve, or light servers to attach to (deprecated, use --light.maxpeers)", |
|
|
|
|
Value: eth.DefaultConfig.LightPeers, |
|
|
|
|
} |
|
|
|
|
LightKDFFlag = cli.BoolFlag{ |
|
|
|
|
Name: "lightkdf", |
|
|
|
|
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength", |
|
|
|
|
LightMaxPeersFlag = cli.IntFlag{ |
|
|
|
|
Name: "light.maxpeers", |
|
|
|
|
Usage: "Maximum number of light clients to serve, or light servers to attach to", |
|
|
|
|
Value: eth.DefaultConfig.LightPeers, |
|
|
|
|
} |
|
|
|
|
WhitelistFlag = cli.StringFlag{ |
|
|
|
|
Name: "whitelist", |
|
|
|
|
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)", |
|
|
|
|
UltraLightServersFlag = cli.StringFlag{ |
|
|
|
|
Name: "ulc.servers", |
|
|
|
|
Usage: "List of trusted ultra-light servers", |
|
|
|
|
Value: strings.Join(eth.DefaultConfig.UltraLightServers, ","), |
|
|
|
|
} |
|
|
|
|
UltraLightFractionFlag = cli.IntFlag{ |
|
|
|
|
Name: "ulc.fraction", |
|
|
|
|
Usage: "Minimum % of trusted ultra-light servers required to announce a new head", |
|
|
|
|
Value: eth.DefaultConfig.UltraLightFraction, |
|
|
|
|
} |
|
|
|
|
UltraLightOnlyAnnounceFlag = cli.BoolFlag{ |
|
|
|
|
Name: "ulc.onlyannounce", |
|
|
|
|
Usage: "Ultra light server sends announcements only", |
|
|
|
|
} |
|
|
|
|
// Dashboard settings
|
|
|
|
|
DashboardEnabledFlag = cli.BoolFlag{ |
|
|
|
@ -949,8 +960,26 @@ func setIPC(ctx *cli.Context, cfg *node.Config) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// setUltraLight configures the ultra light client settings from the command line flags.
|
|
|
|
|
func setUltraLight(ctx *cli.Context, cfg *eth.Config) { |
|
|
|
|
// setLes configures the les server and ultra light client settings from the command line flags.
|
|
|
|
|
func setLes(ctx *cli.Context, cfg *eth.Config) { |
|
|
|
|
if ctx.GlobalIsSet(LightLegacyServFlag.Name) { |
|
|
|
|
cfg.LightServ = ctx.GlobalInt(LightLegacyServFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(LightServeFlag.Name) { |
|
|
|
|
cfg.LightServ = ctx.GlobalInt(LightServeFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(LightIngressFlag.Name) { |
|
|
|
|
cfg.LightIngress = ctx.GlobalInt(LightIngressFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(LightEgressFlag.Name) { |
|
|
|
|
cfg.LightEgress = ctx.GlobalInt(LightEgressFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(LightLegacyPeersFlag.Name) { |
|
|
|
|
cfg.LightPeers = ctx.GlobalInt(LightLegacyPeersFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { |
|
|
|
|
cfg.LightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(UltraLightServersFlag.Name) { |
|
|
|
|
cfg.UltraLightServers = strings.Split(ctx.GlobalString(UltraLightServersFlag.Name), ",") |
|
|
|
|
} |
|
|
|
@ -1056,19 +1085,22 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { |
|
|
|
|
setBootstrapNodesV5(ctx, cfg) |
|
|
|
|
|
|
|
|
|
lightClient := ctx.GlobalString(SyncModeFlag.Name) == "light" |
|
|
|
|
lightServer := ctx.GlobalInt(LightServFlag.Name) != 0 |
|
|
|
|
lightPeers := ctx.GlobalInt(LightPeersFlag.Name) |
|
|
|
|
lightServer := (ctx.GlobalInt(LightLegacyServFlag.Name) != 0 || ctx.GlobalInt(LightServeFlag.Name) != 0) |
|
|
|
|
|
|
|
|
|
lightPeers := ctx.GlobalInt(LightLegacyPeersFlag.Name) |
|
|
|
|
if ctx.GlobalIsSet(LightMaxPeersFlag.Name) { |
|
|
|
|
lightPeers = ctx.GlobalInt(LightMaxPeersFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(MaxPeersFlag.Name) { |
|
|
|
|
cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name) |
|
|
|
|
if lightServer && !ctx.GlobalIsSet(LightPeersFlag.Name) { |
|
|
|
|
if lightServer && !ctx.GlobalIsSet(LightLegacyPeersFlag.Name) && !ctx.GlobalIsSet(LightMaxPeersFlag.Name) { |
|
|
|
|
cfg.MaxPeers += lightPeers |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if lightServer { |
|
|
|
|
cfg.MaxPeers += lightPeers |
|
|
|
|
} |
|
|
|
|
if lightClient && ctx.GlobalIsSet(LightPeersFlag.Name) && cfg.MaxPeers < lightPeers { |
|
|
|
|
if lightClient && (ctx.GlobalIsSet(LightLegacyPeersFlag.Name) || ctx.GlobalIsSet(LightMaxPeersFlag.Name)) && cfg.MaxPeers < lightPeers { |
|
|
|
|
cfg.MaxPeers = lightPeers |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1366,9 +1398,9 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { |
|
|
|
|
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { |
|
|
|
|
// Avoid conflicting network flags
|
|
|
|
|
CheckExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, GoerliFlag) |
|
|
|
|
CheckExclusive(ctx, LightServFlag, SyncModeFlag, "light") |
|
|
|
|
// Can't use both ephemeral unlocked and external signer
|
|
|
|
|
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) |
|
|
|
|
CheckExclusive(ctx, LightLegacyServFlag, LightServeFlag, SyncModeFlag, "light") |
|
|
|
|
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
|
|
|
|
|
|
|
|
|
|
var ks *keystore.KeyStore |
|
|
|
|
if keystores := stack.AccountManager().Backends(keystore.KeyStoreType); len(keystores) > 0 { |
|
|
|
|
ks = keystores[0].(*keystore.KeyStore) |
|
|
|
@ -1379,19 +1411,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { |
|
|
|
|
setEthash(ctx, cfg) |
|
|
|
|
setMiner(ctx, &cfg.Miner) |
|
|
|
|
setWhitelist(ctx, cfg) |
|
|
|
|
setUltraLight(ctx, cfg) |
|
|
|
|
setLes(ctx, cfg) |
|
|
|
|
|
|
|
|
|
if ctx.GlobalIsSet(SyncModeFlag.Name) { |
|
|
|
|
cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(LightServFlag.Name) { |
|
|
|
|
cfg.LightServ = ctx.GlobalInt(LightServFlag.Name) |
|
|
|
|
} |
|
|
|
|
cfg.LightBandwidthIn = ctx.GlobalInt(LightBandwidthInFlag.Name) |
|
|
|
|
cfg.LightBandwidthOut = ctx.GlobalInt(LightBandwidthOutFlag.Name) |
|
|
|
|
if ctx.GlobalIsSet(LightPeersFlag.Name) { |
|
|
|
|
cfg.LightPeers = ctx.GlobalInt(LightPeersFlag.Name) |
|
|
|
|
} |
|
|
|
|
if ctx.GlobalIsSet(NetworkIdFlag.Name) { |
|
|
|
|
cfg.NetworkId = ctx.GlobalUint64(NetworkIdFlag.Name) |
|
|
|
|
} |
|
|
|
|