forked from cerc-io/plugeth
cmd: encapsulate les relative cli options
This commit is contained in:
parent
8c4bc4f7ef
commit
c6a9616cfd
@ -82,6 +82,13 @@ var AppHelpFlagGroups = []flagGroup{
|
||||
utils.GCModeFlag,
|
||||
utils.EthStatsURLFlag,
|
||||
utils.IdentityFlag,
|
||||
utils.LightKDFFlag,
|
||||
utils.WhitelistFlag,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "LES",
|
||||
Flags: []cli.Flag{
|
||||
utils.LightServFlag,
|
||||
utils.LightBandwidthInFlag,
|
||||
utils.LightBandwidthOutFlag,
|
||||
@ -89,8 +96,6 @@ var AppHelpFlagGroups = []flagGroup{
|
||||
utils.UltraLightServersFlag,
|
||||
utils.UltraLightFractionFlag,
|
||||
utils.UltraLightOnlyAnnounceFlag,
|
||||
utils.LightKDFFlag,
|
||||
utils.WhitelistFlag,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -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,6 +201,15 @@ var (
|
||||
Usage: `Blockchain garbage collection mode ("full", "archive")`,
|
||||
Value: "full",
|
||||
}
|
||||
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>)",
|
||||
}
|
||||
// LES settings
|
||||
LightServFlag = cli.IntFlag{
|
||||
Name: "lightserv",
|
||||
Usage: "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)",
|
||||
@ -235,13 +230,19 @@ var (
|
||||
Usage: "Maximum number of LES client peers",
|
||||
Value: eth.DefaultConfig.LightPeers,
|
||||
}
|
||||
LightKDFFlag = cli.BoolFlag{
|
||||
Name: "lightkdf",
|
||||
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
|
||||
UltraLightServersFlag = cli.StringFlag{
|
||||
Name: "ulc.servers",
|
||||
Usage: "List of trusted ultra-light servers",
|
||||
Value: strings.Join(eth.DefaultConfig.UltraLightServers, ","),
|
||||
}
|
||||
WhitelistFlag = cli.StringFlag{
|
||||
Name: "whitelist",
|
||||
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
||||
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 +950,20 @@ 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(LightServFlag.Name) {
|
||||
cfg.LightServ = ctx.GlobalInt(LightServFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(LightBandwidthInFlag.Name) {
|
||||
cfg.LightBandwidthIn = ctx.GlobalInt(LightBandwidthInFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(LightBandwidthOutFlag.Name) {
|
||||
cfg.LightBandwidthOut = ctx.GlobalInt(LightBandwidthOutFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(LightPeersFlag.Name) {
|
||||
cfg.LightPeers = ctx.GlobalInt(LightPeersFlag.Name)
|
||||
}
|
||||
if ctx.GlobalIsSet(UltraLightServersFlag.Name) {
|
||||
cfg.UltraLightServers = strings.Split(ctx.GlobalString(UltraLightServersFlag.Name), ",")
|
||||
}
|
||||
@ -1379,19 +1392,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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user