Use common method to determine file existence

This commit is contained in:
Alexander Simmerl 2018-03-06 16:00:19 +01:00
parent 45d07a3d0b
commit 879b4c0a2c
No known key found for this signature in database
GPG Key ID: 4694E95C9CC61BDA
1 changed files with 1 additions and 2 deletions

View File

@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/tendermint/types"
@ -144,7 +143,7 @@ func LoadPrivValidatorJSON(filePath string) *PrivValidatorJSON {
// or else generates a new one and saves it to the filePath.
func LoadOrGenPrivValidatorJSON(filePath string) *PrivValidatorJSON {
var pvj *PrivValidatorJSON
if _, err := os.Stat(filePath); err == nil {
if cmn.FileExists(filePath) {
pvj = LoadPrivValidatorJSON(filePath)
} else {
pvj = GenPrivValidatorJSON(filePath)