From d3b4d4245817fdb0d320846962af82daf4624356 Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Tue, 10 Oct 2017 03:13:02 -0400 Subject: [PATCH] integrated init --static, fix tests --- examples/eyes/cmd/eyes/init.go | 20 +-------------- server/commands/init.go | 46 ++++++++++++++++++++++++++++------ tests/cli/common.sh | 2 +- 3 files changed, 40 insertions(+), 28 deletions(-) diff --git a/examples/eyes/cmd/eyes/init.go b/examples/eyes/cmd/eyes/init.go index c4c36cf3db..29e682193b 100644 --- a/examples/eyes/cmd/eyes/init.go +++ b/examples/eyes/cmd/eyes/init.go @@ -35,27 +35,9 @@ func initCmd(cmd *cobra.Command, args []string) error { } genesis := getGenesisJSON(viper.GetString(commands.FlagChainID)) - return commands.CreateGenesisValidatorFiles(cfg, genesis, PrivValJSON, cmd.Root().Name()) + return commands.CreateGenesisValidatorFiles(cfg, genesis, commands.StaticPrivValJSON, cmd.Root().Name()) } -// PrivValJSON - validator private key file contents in json -var PrivValJSON = `{ - "address": "7A956FADD20D3A5B2375042B2959F8AB172A058F", - "last_height": 0, - "last_round": 0, - "last_signature": null, - "last_signbytes": "", - "last_step": 0, - "priv_key": { - "type": "ed25519", - "data": "D07ABE82A8B15559A983B2DB5D4842B2B6E4D6AF58B080005662F424F17D68C17B90EA87E7DC0C7145C8C48C08992BE271C7234134343E8A8E8008E617DE7B30" - }, - "pub_key": { - "type": "ed25519", - "data": "7B90EA87E7DC0C7145C8C48C08992BE271C7234134343E8A8E8008E617DE7B30" - } -}` - // TODO: better, auto-generate validator... func getGenesisJSON(chainID string) string { return fmt.Sprintf(`{ diff --git a/server/commands/init.go b/server/commands/init.go index bfdc94430e..5f28406f24 100644 --- a/server/commands/init.go +++ b/server/commands/init.go @@ -29,11 +29,13 @@ var InitCmd = &cobra.Command{ var ( FlagChainID = "chain-id" //TODO group with other flags or remove? is this already a flag here? FlagOption = "option" + FlagStatic = "static" ) func init() { InitCmd.Flags().String(FlagChainID, "test_chain_id", "Chain ID") InitCmd.Flags().StringSliceP(FlagOption, "p", []string{}, "Genesis option in the format /