From 5cbb5d2541bf3e23f92544a0527efd9e363601da Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 21 Dec 2015 17:52:00 -0500 Subject: [PATCH] tendermint init --- cmd/tendermint/init.go | 23 +++++++++++++++++++++++ cmd/tendermint/main.go | 2 ++ config/tendermint/config.go | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 cmd/tendermint/init.go diff --git a/cmd/tendermint/init.go b/cmd/tendermint/init.go new file mode 100644 index 000000000..f38a6f51a --- /dev/null +++ b/cmd/tendermint/init.go @@ -0,0 +1,23 @@ +package main + +import ( + "github.com/tendermint/tendermint/types" +) + +func init_files() { + privValidator := types.GenPrivValidator() + privValidator.SetFile(config.GetString("priv_validator_file")) + privValidator.Save() + + //TODO: chainID + genDoc := types.GenesisDoc{ + ChainID: "hi", + } + genDoc.Validators = []types.GenesisValidator{types.GenesisValidator{ + PubKey: privValidator.PubKey, + Amount: 10000, + }} + + genDoc.SaveAs(config.GetString("genesis_file")) + +} diff --git a/cmd/tendermint/main.go b/cmd/tendermint/main.go index a4ab2b964..6ccbc4d11 100644 --- a/cmd/tendermint/main.go +++ b/cmd/tendermint/main.go @@ -34,6 +34,8 @@ Commands: switch args[0] { case "node": node.RunNode() + case "init": + init_files() case "show_validator": show_validator() case "gen_validator": diff --git a/config/tendermint/config.go b/config/tendermint/config.go index b2e220fc0..84452e2d1 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -56,7 +56,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("moniker", "anonymous") mapConfig.SetDefault("node_laddr", "0.0.0.0:46656") // mapConfig.SetDefault("seeds", "goldenalchemist.chaintest.net:46656") - mapConfig.SetDefault("fast_sync", true) + mapConfig.SetDefault("fast_sync", false) mapConfig.SetDefault("skip_upnp", false) mapConfig.SetDefault("addrbook_file", rootDir+"/addrbook.json") mapConfig.SetDefault("priv_validator_file", rootDir+"/priv_validator.json") @@ -77,7 +77,7 @@ proxy_app = "tcp://127.0.0.1:46658" moniker = "__MONIKER__" node_laddr = "0.0.0.0:46656" seeds = "" -fast_sync = true +fast_sync = false db_backend = "leveldb" log_level = "notice" rpc_laddr = "0.0.0.0:46657"