Cleanup for loop in genesis file load

This commit is contained in:
Ethan Frey 2017-06-23 17:25:53 +02:00
parent 58105dbd4e
commit 6b38abd57b
1 changed files with 8 additions and 12 deletions

View File

@ -78,21 +78,17 @@ func runNode(cmd *cobra.Command, args []string) error {
// TODO: If Mintnet gets deprecated or genesis_file is
// always available, remove.
genDocFile := config.GenesisFile()
if !cmn.FileExists(genDocFile) {
for !cmn.FileExists(genDocFile) {
logger.Info(cmn.Fmt("Waiting for genesis file %v...", genDocFile))
for {
time.Sleep(time.Second)
if !cmn.FileExists(genDocFile) {
continue
}
genDoc, err := ParseGenesisFile()
if err != nil {
return err
}
config.ChainID = genDoc.ChainID
}
time.Sleep(time.Second)
}
genDoc, err := ParseGenesisFile()
if err != nil {
return err
}
config.ChainID = genDoc.ChainID
// Create & start node
n := node.NewNodeDefault(config, logger.With("module", "node"))
if _, err := n.Start(); err != nil {