From 6b38abd57bd9d35b219227552262787076bfdd53 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Fri, 23 Jun 2017 17:25:53 +0200 Subject: [PATCH] Cleanup for loop in genesis file load --- cmd/tendermint/commands/run_node.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index fd05abe5b..997da4d7a 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -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 {