From 7d6033ea5837edc242160c3c18401d612fdf316a Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Mon, 6 Apr 2020 12:33:15 -0400 Subject: [PATCH] Merge PR #5938: x/genutil: fix InitializeNodeValidatorFiles --- CHANGELOG.md | 1 + x/genutil/utils.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bcbedca0..4f1fc9c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -98,6 +98,7 @@ when method receivers are offline/multisig keys. types (eg. keys) to the `auth` module internal amino codec. * (rest) [\#5906](https://github.com/cosmos/cosmos-sdk/pull/5906) Fix an issue that make some REST calls panic when sending invalid or incomplete requests. +* (x/genutil) [\#5938](https://github.com/cosmos/cosmos-sdk/pull/5938) Fix `InitializeNodeValidatorFiles` error handling. ### State Machine Breaking diff --git a/x/genutil/utils.go b/x/genutil/utils.go index 7d1a761ef..3d8aa8f2e 100644 --- a/x/genutil/utils.go +++ b/x/genutil/utils.go @@ -52,7 +52,7 @@ func InitializeNodeValidatorFiles(config *cfg.Config, nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile()) if err != nil { - return nodeID, valPubKey, err + return "", nil, err } nodeID = string(nodeKey.ID()) @@ -60,12 +60,12 @@ func InitializeNodeValidatorFiles(config *cfg.Config, pvKeyFile := config.PrivValidatorKeyFile() if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil { - return nodeID, valPubKey, nil + return "", nil, err } pvStateFile := config.PrivValidatorStateFile() if err := tmos.EnsureDir(filepath.Dir(pvStateFile), 0777); err != nil { - return nodeID, valPubKey, nil + return "", nil, err } valPubKey = privval.LoadOrGenFilePV(pvKeyFile, pvStateFile).GetPubKey()