Upgrade tendermint to 0.28.0-dev0 (#3279)
This commit is contained in:
committed by
Jack Zampolin
parent
05d53894a3
commit
df567616a9
+15
-15
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
amino "github.com/tendermint/go-amino"
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
)
|
||||
|
||||
// ExportGenesisFile creates and writes the genesis configuration to disk. An
|
||||
@@ -58,20 +60,6 @@ func ExportGenesisFileWithTime(
|
||||
return genDoc.SaveAs(genFile)
|
||||
}
|
||||
|
||||
// read of create the private key file for this config
|
||||
func ReadOrCreatePrivValidator(privValFile string) crypto.PubKey {
|
||||
var privValidator *privval.FilePV
|
||||
|
||||
if common.FileExists(privValFile) {
|
||||
privValidator = privval.LoadFilePV(privValFile)
|
||||
} else {
|
||||
privValidator = privval.GenFilePV(privValFile)
|
||||
privValidator.Save()
|
||||
}
|
||||
|
||||
return privValidator.GetPubKey()
|
||||
}
|
||||
|
||||
// InitializeNodeValidatorFiles creates private validator and p2p configuration files.
|
||||
func InitializeNodeValidatorFiles(
|
||||
config *cfg.Config) (nodeID string, valPubKey crypto.PubKey, err error,
|
||||
@@ -83,7 +71,19 @@ func InitializeNodeValidatorFiles(
|
||||
}
|
||||
|
||||
nodeID = string(nodeKey.ID())
|
||||
valPubKey = ReadOrCreatePrivValidator(config.PrivValidatorFile())
|
||||
server.UpgradeOldPrivValFile(config)
|
||||
|
||||
pvKeyFile := config.PrivValidatorKeyFile()
|
||||
if err := common.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil {
|
||||
return nodeID, valPubKey, nil
|
||||
}
|
||||
|
||||
pvStateFile := config.PrivValidatorStateFile()
|
||||
if err := common.EnsureDir(filepath.Dir(pvStateFile), 0777); err != nil {
|
||||
return nodeID, valPubKey, nil
|
||||
}
|
||||
|
||||
valPubKey = privval.LoadOrGenFilePV(pvKeyFile, pvStateFile).GetPubKey()
|
||||
|
||||
return nodeID, valPubKey, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user