Browse Source

Cleanup for loop in genesis file load

pull/561/head
Ethan Frey 7 years ago
parent
commit
6b38abd57b
1 changed files with 8 additions and 12 deletions
  1. +8
    -12
      cmd/tendermint/commands/run_node.go

+ 8
- 12
cmd/tendermint/commands/run_node.go 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 {


Loading…
Cancel
Save