Browse Source

generate node_key when running tendermint init

pull/1439/head
Anton Kaliaev 6 years ago
parent
commit
2b732bc11a
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      cmd/tendermint/commands/init.go

+ 11
- 0
cmd/tendermint/commands/init.go View File

@ -3,6 +3,7 @@ package commands
import (
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/types"
pvm "github.com/tendermint/tendermint/types/priv_validator"
cmn "github.com/tendermint/tmlibs/common"
@ -28,6 +29,16 @@ func initFiles(cmd *cobra.Command, args []string) {
logger.Info("Generated private validator", "path", privValFile)
}
nodeKeyFile := config.NodeKeyFile()
if cmn.FileExists(nodeKeyFile) {
logger.Info("Found node key", "path", nodeKeyFile)
} else {
if _, err := p2p.LoadOrGenNodeKey(nodeKeyFile); err != nil {
panic(err)
}
logger.Info("Generated node key", "path", nodeKeyFile)
}
// genesis file
genFile := config.GenesisFile()
if cmn.FileExists(genFile) {


Loading…
Cancel
Save