mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-03 08:31:20 +00:00
added use of Cobra CLI
squash
This commit is contained in:
parent
d4f6254551
commit
569fd474c2
27
cmd/tendermint/commands/gen_validator.go
Normal file
27
cmd/tendermint/commands/gen_validator.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/tendermint/go-wire"
|
||||||
|
"github.com/tendermint/tendermint/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
var genValidatorCmd = &cobra.Command{
|
||||||
|
Use: "gen_validator",
|
||||||
|
Short: "Generate new validator keypair",
|
||||||
|
Run: genValidator,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(genValidatorCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func genValidator(cmd *cobra.Command, args []string) {
|
||||||
|
privValidator := types.GenPrivValidator()
|
||||||
|
privValidatorJSONBytes := wire.JSONBytesPretty(privValidator)
|
||||||
|
fmt.Printf(`%v
|
||||||
|
`, string(privValidatorJSONBytes))
|
||||||
|
}
|
@ -1,13 +1,25 @@
|
|||||||
package main
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
cmn "github.com/tendermint/go-common"
|
cmn "github.com/tendermint/go-common"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init_files() {
|
var initFilesCmd = &cobra.Command{
|
||||||
|
Use: "init",
|
||||||
|
Short: "Initialize Tendermint",
|
||||||
|
Run: initFiles,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(initFilesCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func initFiles(cmd *cobra.Command, args []string) {
|
||||||
privValFile := config.GetString("priv_validator_file")
|
privValFile := config.GetString("priv_validator_file")
|
||||||
if _, err := os.Stat(privValFile); os.IsNotExist(err) {
|
if _, err := os.Stat(privValFile); os.IsNotExist(err) {
|
||||||
privValidator := types.GenPrivValidator()
|
privValidator := types.GenPrivValidator()
|
@ -1,13 +1,25 @@
|
|||||||
package main
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/tendermint/go-p2p/upnp"
|
"github.com/tendermint/go-p2p/upnp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func probe_upnp() {
|
var probeUpnpCmd = &cobra.Command{
|
||||||
|
Use: "probe_upnp",
|
||||||
|
Short: "Test UPnP functionality",
|
||||||
|
Run: probeUpnp,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(probeUpnpCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func probeUpnp(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
capabilities, err := upnp.Probe()
|
capabilities, err := upnp.Probe()
|
||||||
if err != nil {
|
if err != nil {
|
40
cmd/tendermint/commands/replay.go
Normal file
40
cmd/tendermint/commands/replay.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/tendermint/tendermint/consensus"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var replayCmd = &cobra.Command{
|
||||||
|
Use: "replay",
|
||||||
|
Short: "Replay messages from WAL",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
if len(args) > 1 {
|
||||||
|
consensus.RunReplayFile(config, args[1], false)
|
||||||
|
} else {
|
||||||
|
fmt.Println("replay requires an argument (walfile)")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var replayConsoleCmd = &cobra.Command{
|
||||||
|
Use: "replay_console",
|
||||||
|
Short: "Replay messages from WAL in a console",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
if len(args) > 1 {
|
||||||
|
consensus.RunReplayFile(config, args[1], true)
|
||||||
|
} else {
|
||||||
|
fmt.Println("replay_console requires an argument (walfile)")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(replayCmd)
|
||||||
|
RootCmd.AddCommand(replayConsoleCmd)
|
||||||
|
}
|
@ -1,22 +1,41 @@
|
|||||||
package main
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var resetAllCmd = &cobra.Command{
|
||||||
|
Use: "unsafe_reset_all",
|
||||||
|
Short: "(unsafe) Remove all the data and WAL, reset this node's validator",
|
||||||
|
Run: resetAll,
|
||||||
|
}
|
||||||
|
|
||||||
|
var resetPrivValidatorCmd = &cobra.Command{
|
||||||
|
Use: "unsafe_reset_priv_validator",
|
||||||
|
Short: "(unsafe) Reset this node's validator",
|
||||||
|
Run: resetPrivValidator,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(resetAllCmd)
|
||||||
|
RootCmd.AddCommand(resetPrivValidatorCmd)
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: this is totally unsafe.
|
// XXX: this is totally unsafe.
|
||||||
// it's only suitable for testnets.
|
// it's only suitable for testnets.
|
||||||
func reset_all() {
|
func resetAll(cmd *cobra.Command, args []string) {
|
||||||
reset_priv_validator()
|
resetPrivValidator(cmd, args)
|
||||||
os.RemoveAll(config.GetString("db_dir"))
|
os.RemoveAll(config.GetString("db_dir"))
|
||||||
os.Remove(config.GetString("cs_wal_file"))
|
os.Remove(config.GetString("cs_wal_file"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: this is totally unsafe.
|
// XXX: this is totally unsafe.
|
||||||
// it's only suitable for testnets.
|
// it's only suitable for testnets.
|
||||||
func reset_priv_validator() {
|
func resetPrivValidator(cmd *cobra.Command, args []string) {
|
||||||
// Get PrivValidator
|
// Get PrivValidator
|
||||||
var privValidator *types.PrivValidator
|
var privValidator *types.PrivValidator
|
||||||
privValidatorFile := config.GetString("priv_validator_file")
|
privValidatorFile := config.GetString("priv_validator_file")
|
76
cmd/tendermint/commands/root.go
Normal file
76
cmd/tendermint/commands/root.go
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
cfg "github.com/tendermint/go-config"
|
||||||
|
"github.com/tendermint/go-logger"
|
||||||
|
tmcfg "github.com/tendermint/tendermint/config/tendermint"
|
||||||
|
)
|
||||||
|
|
||||||
|
var config cfg.Config
|
||||||
|
var log = logger.New("module", "main")
|
||||||
|
|
||||||
|
//global flags
|
||||||
|
var (
|
||||||
|
printHelp bool
|
||||||
|
moniker string
|
||||||
|
nodeLaddr string
|
||||||
|
seeds string
|
||||||
|
fastSync bool
|
||||||
|
skipUPNP bool
|
||||||
|
rpcLaddr string
|
||||||
|
grpcLaddr string
|
||||||
|
logLevel string
|
||||||
|
proxyApp string
|
||||||
|
abciTransport string
|
||||||
|
|
||||||
|
pex bool
|
||||||
|
)
|
||||||
|
|
||||||
|
var RootCmd = &cobra.Command{
|
||||||
|
Use: "tendermint",
|
||||||
|
Short: "Tendermint Core (BFT Consensus) in Go",
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
// Get configuration
|
||||||
|
config = tmcfg.GetConfig("")
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
// parse flags
|
||||||
|
|
||||||
|
// configuration options
|
||||||
|
RootCmd.PersistentFlags().StringVar(&moniker, "moniker", config.GetString("moniker"), "Node Name")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&nodeLaddr, "node_laddr", config.GetString("node_laddr"), "Node listen address. (0.0.0.0:0 means any interface, any port)")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&seeds, "seeds", config.GetString("seeds"), "Comma delimited host:port seed nodes")
|
||||||
|
RootCmd.PersistentFlags().BoolVar(&fastSync, "fast_sync", config.GetBool("fast_sync"), "Fast blockchain syncing")
|
||||||
|
RootCmd.PersistentFlags().BoolVar(&skipUPNP, "skip_upnp", config.GetBool("skip_upnp"), "Skip UPNP configuration")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&rpcLaddr, "rpc_laddr", config.GetString("rpc_laddr"), "RPC listen address. Port required")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&grpcLaddr, "grpc_laddr", config.GetString("grpc_laddr"), "GRPC listen address (BroadcastTx only). Port required")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&logLevel, "log_level", config.GetString("log_level"), "Log level")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&proxyApp, "proxy_app", config.GetString("proxy_app"), "Proxy app address, or 'nilapp' or 'dummy' for local testing.")
|
||||||
|
RootCmd.PersistentFlags().StringVar(&abciTransport, "abci", config.GetString("abci"), "Specify abci transport (socket | grpc)")
|
||||||
|
|
||||||
|
// feature flags
|
||||||
|
RootCmd.PersistentFlags().BoolVar(&pex, "pex", config.GetBool("pex_reactor"), "Enable Peer-Exchange (dev feature)")
|
||||||
|
|
||||||
|
//------------------
|
||||||
|
|
||||||
|
// Merge parsed flag values onto config
|
||||||
|
config.Set("moniker", moniker)
|
||||||
|
config.Set("node_laddr", nodeLaddr)
|
||||||
|
config.Set("seeds", seeds)
|
||||||
|
config.Set("fast_sync", fastSync)
|
||||||
|
config.Set("skip_upnp", skipUPNP)
|
||||||
|
config.Set("rpc_laddr", rpcLaddr)
|
||||||
|
config.Set("grpc_laddr", grpcLaddr)
|
||||||
|
config.Set("log_level", logLevel)
|
||||||
|
config.Set("proxy_app", proxyApp)
|
||||||
|
config.Set("abci", abciTransport)
|
||||||
|
config.Set("pex_reactor", pex)
|
||||||
|
|
||||||
|
// set the log level
|
||||||
|
logger.SetLogLevel(config.GetString("log_level"))
|
||||||
|
}
|
@ -1,22 +1,33 @@
|
|||||||
package main
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
. "github.com/tendermint/go-common"
|
. "github.com/tendermint/go-common"
|
||||||
cfg "github.com/tendermint/go-config"
|
|
||||||
"github.com/tendermint/tendermint/node"
|
"github.com/tendermint/tendermint/node"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var runNodeCmd = &cobra.Command{
|
||||||
|
Use: "node",
|
||||||
|
Short: "Run the tendermint node",
|
||||||
|
Run: runNode,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(runNodeCmd)
|
||||||
|
}
|
||||||
|
|
||||||
// Users wishing to:
|
// Users wishing to:
|
||||||
// * Use an external signer for their validators
|
// * Use an external signer for their validators
|
||||||
// * Supply an in-proc abci app
|
// * Supply an in-proc abci app
|
||||||
// should import github.com/tendermint/tendermint/node and implement
|
// should import github.com/tendermint/tendermint/node and implement
|
||||||
// their own run_node to call node.NewNode (instead of node.NewNodeDefault)
|
// their own run_node to call node.NewNode (instead of node.NewNodeDefault)
|
||||||
// with their custom priv validator and/or custom proxy.ClientCreator
|
// with their custom priv validator and/or custom proxy.ClientCreator
|
||||||
func run_node(config cfg.Config) {
|
func runNode(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// Wait until the genesis doc becomes available
|
// Wait until the genesis doc becomes available
|
||||||
// This is for Mintnet compatibility.
|
// This is for Mintnet compatibility.
|
||||||
@ -55,5 +66,4 @@ func run_node(config cfg.Config) {
|
|||||||
|
|
||||||
// Trap signal, run forever.
|
// Trap signal, run forever.
|
||||||
n.RunForever()
|
n.RunForever()
|
||||||
|
|
||||||
}
|
}
|
@ -1,13 +1,25 @@
|
|||||||
package main
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func show_validator() {
|
var showValidatorCmd = &cobra.Command{
|
||||||
|
Use: "show_validator",
|
||||||
|
Short: "Show this node's validator info",
|
||||||
|
Run: showValidator,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(showValidatorCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func showValidator(cmd *cobra.Command, args []string) {
|
||||||
privValidatorFile := config.GetString("priv_validator_file")
|
privValidatorFile := config.GetString("priv_validator_file")
|
||||||
privValidator := types.LoadOrGenPrivValidator(privValidatorFile)
|
privValidator := types.LoadOrGenPrivValidator(privValidatorFile)
|
||||||
fmt.Println(string(wire.JSONBytesPretty(privValidator.PubKey)))
|
fmt.Println(string(wire.JSONBytesPretty(privValidator.PubKey)))
|
21
cmd/tendermint/commands/version.go
Normal file
21
cmd/tendermint/commands/version.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/tendermint/tendermint/version"
|
||||||
|
)
|
||||||
|
|
||||||
|
var versionCmd = &cobra.Command{
|
||||||
|
Use: "version",
|
||||||
|
Short: "Show version info",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Println(version.Version)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RootCmd.AddCommand(versionCmd)
|
||||||
|
}
|
@ -1,66 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
flag "github.com/spf13/pflag"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
cfg "github.com/tendermint/go-config"
|
|
||||||
)
|
|
||||||
|
|
||||||
func parseFlags(config cfg.Config, args []string) {
|
|
||||||
var (
|
|
||||||
printHelp bool
|
|
||||||
moniker string
|
|
||||||
nodeLaddr string
|
|
||||||
seeds string
|
|
||||||
fastSync bool
|
|
||||||
skipUPNP bool
|
|
||||||
rpcLaddr string
|
|
||||||
grpcLaddr string
|
|
||||||
logLevel string
|
|
||||||
proxyApp string
|
|
||||||
abciTransport string
|
|
||||||
|
|
||||||
pex bool
|
|
||||||
)
|
|
||||||
|
|
||||||
// Declare flags
|
|
||||||
var flags = flag.NewFlagSet("main", flag.ExitOnError)
|
|
||||||
flags.BoolVar(&printHelp, "help", false, "Print this help message.")
|
|
||||||
|
|
||||||
// configuration options
|
|
||||||
flags.StringVar(&moniker, "moniker", config.GetString("moniker"), "Node Name")
|
|
||||||
flags.StringVar(&nodeLaddr, "node_laddr", config.GetString("node_laddr"), "Node listen address. (0.0.0.0:0 means any interface, any port)")
|
|
||||||
flags.StringVar(&seeds, "seeds", config.GetString("seeds"), "Comma delimited host:port seed nodes")
|
|
||||||
flags.BoolVar(&fastSync, "fast_sync", config.GetBool("fast_sync"), "Fast blockchain syncing")
|
|
||||||
flags.BoolVar(&skipUPNP, "skip_upnp", config.GetBool("skip_upnp"), "Skip UPNP configuration")
|
|
||||||
flags.StringVar(&rpcLaddr, "rpc_laddr", config.GetString("rpc_laddr"), "RPC listen address. Port required")
|
|
||||||
flags.StringVar(&grpcLaddr, "grpc_laddr", config.GetString("grpc_laddr"), "GRPC listen address (BroadcastTx only). Port required")
|
|
||||||
flags.StringVar(&logLevel, "log_level", config.GetString("log_level"), "Log level")
|
|
||||||
flags.StringVar(&proxyApp, "proxy_app", config.GetString("proxy_app"),
|
|
||||||
"Proxy app address, or 'nilapp' or 'dummy' for local testing.")
|
|
||||||
flags.StringVar(&abciTransport, "abci", config.GetString("abci"), "Specify abci transport (socket | grpc)")
|
|
||||||
|
|
||||||
// feature flags
|
|
||||||
flags.BoolVar(&pex, "pex", config.GetBool("pex_reactor"), "Enable Peer-Exchange (dev feature)")
|
|
||||||
|
|
||||||
flags.Parse(args)
|
|
||||||
if printHelp {
|
|
||||||
flags.PrintDefaults()
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Merge parsed flag values onto app.
|
|
||||||
config.Set("moniker", moniker)
|
|
||||||
config.Set("node_laddr", nodeLaddr)
|
|
||||||
config.Set("seeds", seeds)
|
|
||||||
config.Set("fast_sync", fastSync)
|
|
||||||
config.Set("skip_upnp", skipUPNP)
|
|
||||||
config.Set("rpc_laddr", rpcLaddr)
|
|
||||||
config.Set("grpc_laddr", grpcLaddr)
|
|
||||||
config.Set("log_level", logLevel)
|
|
||||||
config.Set("proxy_app", proxyApp)
|
|
||||||
config.Set("abci", abciTransport)
|
|
||||||
|
|
||||||
config.Set("pex_reactor", pex)
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/tendermint/go-wire"
|
|
||||||
"github.com/tendermint/tendermint/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func gen_validator() {
|
|
||||||
privValidator := types.GenPrivValidator()
|
|
||||||
privValidatorJSONBytes := wire.JSONBytesPretty(privValidator)
|
|
||||||
fmt.Printf(`%v
|
|
||||||
`, string(privValidatorJSONBytes))
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/tendermint/go-logger"
|
|
||||||
)
|
|
||||||
|
|
||||||
var log = logger.New("module", "main")
|
|
@ -4,76 +4,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
cfg "github.com/tendermint/go-config"
|
cmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||||
"github.com/tendermint/go-logger"
|
|
||||||
tmcfg "github.com/tendermint/tendermint/config/tendermint"
|
|
||||||
"github.com/tendermint/tendermint/consensus"
|
|
||||||
"github.com/tendermint/tendermint/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var config cfg.Config
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
if err := cmd.RootCmd.Execute(); err != nil {
|
||||||
args := os.Args[1:]
|
fmt.Println(err)
|
||||||
if len(args) == 0 {
|
|
||||||
fmt.Println(`Tendermint
|
|
||||||
|
|
||||||
Commands:
|
|
||||||
init Initialize tendermint
|
|
||||||
node Run the tendermint node
|
|
||||||
show_validator Show this node's validator info
|
|
||||||
gen_validator Generate new validator keypair
|
|
||||||
probe_upnp Test UPnP functionality
|
|
||||||
replay <walfile> Replay messages from WAL
|
|
||||||
replay_console <walfile> Replay messages from WAL in a console
|
|
||||||
unsafe_reset_all (unsafe) Remove all the data and WAL, reset this node's validator
|
|
||||||
unsafe_reset_priv_validator (unsafe) Reset this node's validator
|
|
||||||
version Show version info
|
|
||||||
`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get configuration
|
|
||||||
config = tmcfg.GetConfig("")
|
|
||||||
parseFlags(config, args[1:]) // Command line overrides
|
|
||||||
|
|
||||||
// set the log level
|
|
||||||
logger.SetLogLevel(config.GetString("log_level"))
|
|
||||||
|
|
||||||
switch args[0] {
|
|
||||||
case "node":
|
|
||||||
run_node(config)
|
|
||||||
case "replay":
|
|
||||||
if len(args) > 1 {
|
|
||||||
consensus.RunReplayFile(config, args[1], false)
|
|
||||||
} else {
|
|
||||||
fmt.Println("replay requires an argument (walfile)")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
case "replay_console":
|
|
||||||
if len(args) > 1 {
|
|
||||||
consensus.RunReplayFile(config, args[1], true)
|
|
||||||
} else {
|
|
||||||
fmt.Println("replay_console requires an argument (walfile)")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
case "init":
|
|
||||||
init_files()
|
|
||||||
case "show_validator":
|
|
||||||
show_validator()
|
|
||||||
case "gen_validator":
|
|
||||||
gen_validator()
|
|
||||||
case "probe_upnp":
|
|
||||||
probe_upnp()
|
|
||||||
case "unsafe_reset_all":
|
|
||||||
reset_all()
|
|
||||||
case "unsafe_reset_priv_validator":
|
|
||||||
reset_priv_validator()
|
|
||||||
case "version":
|
|
||||||
fmt.Println(version.Version)
|
|
||||||
default:
|
|
||||||
fmt.Printf("Unknown command %v\n", args[0])
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user