aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2018-12-13 10:45:29 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:54 +0800
commitbffc4410c72dbe2b9461ef78867f972f939a95a4 (patch)
treefeda6cff67ff8e7ae2784fddd3804255c73d1b2c /cmd/utils
parent002cabe12c347971e9d9d31f0f5759d5588431f0 (diff)
downloaddexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.tar
dexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.tar.gz
dexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.tar.bz2
dexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.tar.lz
dexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.tar.xz
dexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.tar.zst
dexon-bffc4410c72dbe2b9461ef78867f972f939a95a4.zip
dex, cmd: Add DMoment to command line (#87)
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 03b0841b0..971ccd349 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -326,6 +326,10 @@ var (
Name: "bp",
Usage: "Enable block proposer mode (node set)",
}
+ ConsensusDMomentFlag = cli.Uint64Flag{
+ Name: "dmoment",
+ Usage: "Set the DMoment of DEXON Consensus (unix timestamp)",
+ }
// Miner settings
MiningEnabledFlag = cli.BoolFlag{
Name: "mine",
@@ -1268,6 +1272,16 @@ func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) {
if gen := ctx.GlobalInt(TrieCacheGenFlag.Name); gen > 0 {
state.MaxTrieCacheGen = uint16(gen)
}
+ if ctx.GlobalIsSet(ConsensusDMomentFlag.Name) {
+ cfg.DMoment = int64(ctx.GlobalUint64(ConsensusDMomentFlag.Name))
+ } else {
+ // TODO(jimmy): default DMoment should be set based on networkId.
+ now := time.Now()
+ cfg.DMoment = time.Date(
+ now.Year(), now.Month(), now.Day(),
+ now.Hour(), now.Minute(), (now.Second()/5+1)*5,
+ 0, now.Location()).Unix()
+ }
}
// SetDashboardConfig applies dashboard related command line flags to the config.