diff options
author | Sonic <sonic@cobinhood.com> | 2018-10-22 11:49:29 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:50 +0800 |
commit | b5c7aaae2a314bb259bf9fc5bd2ee58a4d10661a (patch) | |
tree | 5d78a0c2eecc9a763f28caae8ec64006dde05c41 /cmd | |
parent | 57e39b9f4813087014082d98f505631e616f0cb1 (diff) | |
download | dexon-b5c7aaae2a314bb259bf9fc5bd2ee58a4d10661a.tar.gz dexon-b5c7aaae2a314bb259bf9fc5bd2ee58a4d10661a.tar.zst dexon-b5c7aaae2a314bb259bf9fc5bd2ee58a4d10661a.zip |
geth: add propose flag to enable/disable proposing
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/main.go | 15 | ||||
-rw-r--r-- | cmd/geth/usage.go | 6 | ||||
-rw-r--r-- | cmd/utils/flags.go | 5 |
3 files changed, 26 insertions, 0 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 956469b9e..05f5c45b6 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -31,6 +31,7 @@ import ( "github.com/dexon-foundation/dexon/accounts/keystore" "github.com/dexon-foundation/dexon/cmd/utils" "github.com/dexon-foundation/dexon/console" + "github.com/dexon-foundation/dexon/dex" "github.com/dexon-foundation/dexon/eth" "github.com/dexon-foundation/dexon/ethclient" "github.com/dexon-foundation/dexon/internal/debug" @@ -96,6 +97,7 @@ var ( utils.ListenPortFlag, utils.MaxPeersFlag, utils.MaxPendingPeersFlag, + utils.ProposingEnabledFlag, utils.MiningEnabledFlag, utils.MinerThreadsFlag, utils.MinerLegacyThreadsFlag, @@ -355,4 +357,17 @@ func startNode(ctx *cli.Context, stack *node.Node) { utils.Fatalf("Failed to start mining: %v", err) } } + + if ctx.GlobalBool(utils.ProposingEnabledFlag.Name) { + if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { + utils.Fatalf("Light clients do not support proposing") + } + var dexon *dex.Dexon + if err := stack.Service(&dexon); err != nil { + utils.Fatalf("Dexon service not running: %v", err) + } + if err := dexon.StartProposing(); err != nil { + utils.Fatalf("Failed to string proposing: %v", err) + } + } } diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 18c9743e0..fb14a9bbd 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -184,6 +184,12 @@ var AppHelpFlagGroups = []flagGroup{ }, }, { + Name: "PROPOSER", + Flags: []cli.Flag{ + utils.ProposingEnabledFlag, + }, + }, + { Name: "MINER", Flags: []cli.Flag{ utils.MiningEnabledFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index cf41f5cdd..585f9c313 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -317,6 +317,11 @@ var ( Usage: "Number of trie node generations to keep in memory", Value: int(state.MaxTrieCacheGen), } + // Proposer settings + ProposingEnabledFlag = cli.BoolFlag{ + Name: "propose", + Usage: "Enable proposing", + } // Miner settings MiningEnabledFlag = cli.BoolFlag{ Name: "mine", |