cmd/*: add Istanbul command line flags

This commit is contained in:
Edwin 2017-06-22 15:02:44 +08:00 committed by mark.lin
parent dacf71e018
commit 84e22adfba
3 changed files with 31 additions and 0 deletions

View file

@ -122,6 +122,8 @@ var (
utils.GpoPercentileFlag, utils.GpoPercentileFlag,
utils.ExtraDataFlag, utils.ExtraDataFlag,
configFileFlag, configFileFlag,
utils.IstanbulRequestTimeoutFlag,
utils.IstanbulBlockPeriodFlag,
} }
rpcFlags = []cli.Flag{ rpcFlags = []cli.Flag{

View file

@ -225,6 +225,13 @@ var AppHelpFlagGroups = []flagGroup{
{ {
Name: "MISC", Name: "MISC",
}, },
{
Name: "ISTANBUL",
Flags: []cli.Flag{
utils.IstanbulRequestTimeoutFlag,
utils.IstanbulBlockPeriodFlag,
},
},
} }
// byCategory sorts an array of flagGroup by Name in the order // byCategory sorts an array of flagGroup by Name in the order

View file

@ -532,6 +532,18 @@ var (
Usage: "Minimum POW accepted", Usage: "Minimum POW accepted",
Value: whisper.DefaultMinimumPoW, Value: whisper.DefaultMinimumPoW,
} }
// Istanbul settings
IstanbulRequestTimeoutFlag = cli.Uint64Flag{
Name: "istanbul.requesttimeout",
Usage: "Timeout for each Istanbul round in milliseconds",
Value: eth.DefaultConfig.Istanbul.RequestTimeout,
}
IstanbulBlockPeriodFlag = cli.Uint64Flag{
Name: "istanbul.blockperiod",
Usage: "Default minimum difference between two consecutive block's timestamps in seconds",
Value: eth.DefaultConfig.Istanbul.BlockPeriod,
}
) )
// MakeDataDir retrieves the currently requested data directory, terminating // MakeDataDir retrieves the currently requested data directory, terminating
@ -961,6 +973,15 @@ func setEthash(ctx *cli.Context, cfg *eth.Config) {
} }
} }
func setIstanbul(ctx *cli.Context, cfg *eth.Config) {
if ctx.GlobalIsSet(IstanbulRequestTimeoutFlag.Name) {
cfg.Istanbul.RequestTimeout = ctx.GlobalUint64(IstanbulRequestTimeoutFlag.Name)
}
if ctx.GlobalIsSet(IstanbulBlockPeriodFlag.Name) {
cfg.Istanbul.BlockPeriod = ctx.GlobalUint64(IstanbulBlockPeriodFlag.Name)
}
}
// checkExclusive verifies that only a single isntance of the provided flags was // checkExclusive verifies that only a single isntance of the provided flags was
// set by the user. Each flag might optionally be followed by a string type to // set by the user. Each flag might optionally be followed by a string type to
// specialize it further. // specialize it further.
@ -1022,6 +1043,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
setGPO(ctx, &cfg.GPO) setGPO(ctx, &cfg.GPO)
setTxPool(ctx, &cfg.TxPool) setTxPool(ctx, &cfg.TxPool)
setEthash(ctx, cfg) setEthash(ctx, cfg)
setIstanbul(ctx, cfg)
switch { switch {
case ctx.GlobalIsSet(SyncModeFlag.Name): case ctx.GlobalIsSet(SyncModeFlag.Name):