diff --git a/CHANGELOG.md b/CHANGELOG.md index 7479cf5ca409..fcb66f41f1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [v0.37.9] - 2020-04-09 +### Bug Fixes + +* (client/context) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) Fix incorrect instantiation of tmlite verifier when --trust-node is off. + +## [v0.37.9] - 2020-04-09 + ### Improvements * (tendermint) Bump Tendermint version to [v0.32.10](https://github.com/tendermint/tendermint/releases/tag/v0.32.10). diff --git a/client/context/context.go b/client/context/context.go index 18f50240d4b6..1e8e2d6416d2 100644 --- a/client/context/context.go +++ b/client/context/context.go @@ -74,8 +74,9 @@ func NewCLIContextWithFrom(from string) CLIContext { } } + trustNode := viper.GetBool(flags.FlagTrustNode) // We need to use a single verifier for all contexts - if verifier == nil || verifierHome != viper.GetString(flags.FlagHome) { + if !trustNode && (verifier == nil || verifierHome != viper.GetString(flags.FlagHome)) { verifier = createVerifier() verifierHome = viper.GetString(flags.FlagHome) } @@ -87,7 +88,7 @@ func NewCLIContextWithFrom(from string) CLIContext { From: viper.GetString(flags.FlagFrom), OutputFormat: viper.GetString(cli.OutputFlag), Height: viper.GetInt64(flags.FlagHeight), - TrustNode: viper.GetBool(flags.FlagTrustNode), + TrustNode: trustNode, UseLedger: viper.GetBool(flags.FlagUseLedger), BroadcastMode: viper.GetString(flags.FlagBroadcastMode), Verifier: verifier, @@ -105,16 +106,6 @@ func NewCLIContextWithFrom(from string) CLIContext { func NewCLIContext() CLIContext { return NewCLIContextWithFrom(viper.GetString(flags.FlagFrom)) } func createVerifier() tmlite.Verifier { - trustNodeDefined := viper.IsSet(flags.FlagTrustNode) - if !trustNodeDefined { - return nil - } - - trustNode := viper.GetBool(flags.FlagTrustNode) - if trustNode { - return nil - } - chainID := viper.GetString(flags.FlagChainID) home := viper.GetString(flags.FlagHome) nodeURI := viper.GetString(flags.FlagNode)