Merge PR #2370: Improve error handler in certifier creation

This commit is contained in:
HaoyangLiu 2018-09-21 23:44:39 +08:00 committed by Christopher Goes
parent 8721dd6ff8
commit d06c589436
2 changed files with 5 additions and 4 deletions

View File

@ -94,13 +94,15 @@ func createCertifier() tmlite.Certifier {
errMsg.WriteString("--node ")
}
if errMsg.Len() != 0 {
fmt.Printf("must specify these options: %s when --trust-node is false\n", errMsg.String())
fmt.Printf("Must specify these options: %s when --trust-node is false\n", errMsg.String())
os.Exit(1)
}
certifier, err := tmliteProxy.GetCertifier(chainID, home, nodeURI)
if err != nil {
panic(err)
fmt.Printf("Create certifier failed: %s\n", err.Error())
fmt.Printf("Please check network connection and verify the address of the node to connect to\n")
os.Exit(1)
}
return certifier

View File

@ -12,7 +12,6 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/context"
sdk "github.com/cosmos/cosmos-sdk/types"
tmTypes "github.com/tendermint/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
)
@ -78,7 +77,7 @@ func getValidators(cliCtx context.CLIContext, height *int64) ([]byte, error) {
return nil, err
}
if !bytes.Equal(check.ValidatorsHash(), tmTypes.NewValidatorSet(validatorsRes.Validators).Hash()) {
if !bytes.Equal(check.ValidatorsHash(), tmtypes.NewValidatorSet(validatorsRes.Validators).Hash()) {
return nil, fmt.Errorf("got invalid validatorset")
}
}