Skip to content

Commit 07b8fe0

Browse files
author
Alessio Treglia
committed
instantiate verifier when --trust-node is on
Closes: #5964
1 parent 469463a commit 07b8fe0

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Ref: https://keepachangelog.com/en/1.0.0/
3737

3838
## [v0.37.9] - 2020-04-09
3939

40+
### Bug Fixes
41+
42+
* (client/context) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) Fix incorrect instantiation of tmlite verifier when --trust-node is off.
43+
44+
## [v0.37.9] - 2020-04-09
45+
4046
### Improvements
4147

4248
* (tendermint) Bump Tendermint version to [v0.32.10](https://github.com/tendermint/tendermint/releases/tag/v0.32.10).

client/context/context.go

+3-12
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ func NewCLIContextWithFrom(from string) CLIContext {
7474
}
7575
}
7676

77+
trustNode := viper.GetBool(flags.FlagTrustNode)
7778
// We need to use a single verifier for all contexts
78-
if verifier == nil || verifierHome != viper.GetString(flags.FlagHome) {
79+
if !trustNode && (verifier == nil || verifierHome != viper.GetString(flags.FlagHome)) {
7980
verifier = createVerifier()
8081
verifierHome = viper.GetString(flags.FlagHome)
8182
}
@@ -87,7 +88,7 @@ func NewCLIContextWithFrom(from string) CLIContext {
8788
From: viper.GetString(flags.FlagFrom),
8889
OutputFormat: viper.GetString(cli.OutputFlag),
8990
Height: viper.GetInt64(flags.FlagHeight),
90-
TrustNode: viper.GetBool(flags.FlagTrustNode),
91+
TrustNode: trustNode,
9192
UseLedger: viper.GetBool(flags.FlagUseLedger),
9293
BroadcastMode: viper.GetString(flags.FlagBroadcastMode),
9394
Verifier: verifier,
@@ -105,16 +106,6 @@ func NewCLIContextWithFrom(from string) CLIContext {
105106
func NewCLIContext() CLIContext { return NewCLIContextWithFrom(viper.GetString(flags.FlagFrom)) }
106107

107108
func createVerifier() tmlite.Verifier {
108-
trustNodeDefined := viper.IsSet(flags.FlagTrustNode)
109-
if !trustNodeDefined {
110-
return nil
111-
}
112-
113-
trustNode := viper.GetBool(flags.FlagTrustNode)
114-
if trustNode {
115-
return nil
116-
}
117-
118109
chainID := viper.GetString(flags.FlagChainID)
119110
home := viper.GetString(flags.FlagHome)
120111
nodeURI := viper.GetString(flags.FlagNode)

0 commit comments

Comments
 (0)