persistent node key and ID

This commit is contained in:
Ethan Buchman
2018-01-01 20:21:42 -05:00
parent f2e0abf1dc
commit b289d2baf4
6 changed files with 204 additions and 18 deletions

View File

@@ -72,6 +72,9 @@ type BaseConfig struct {
// A JSON file containing the private key to use as a validator in the consensus protocol
PrivValidator string `mapstructure:"priv_validator_file"`
// A JSON file containing the private key to use for p2p authenticated encryption
NodeKey string `mapstructure:"node_key"`
// A custom human readable name for this node
Moniker string `mapstructure:"moniker"`
@@ -109,6 +112,7 @@ func DefaultBaseConfig() BaseConfig {
return BaseConfig{
Genesis: "genesis.json",
PrivValidator: "priv_validator.json",
NodeKey: "node_key.json",
Moniker: defaultMoniker,
ProxyApp: "tcp://127.0.0.1:46658",
ABCI: "socket",
@@ -141,6 +145,11 @@ func (b BaseConfig) PrivValidatorFile() string {
return rootify(b.PrivValidator, b.RootDir)
}
// NodeKeyFile returns the full path to the node_key.json file
func (b BaseConfig) NodeKeyFile() string {
return rootify(b.NodeKey, b.RootDir)
}
// DBDir returns the full path to the database directory
func (b BaseConfig) DBDir() string {
return rootify(b.DBPath, b.RootDir)