Skip to content

Commit

Permalink
R4R - Store consensus state correctly (#5242)
Browse files Browse the repository at this point in the history
* store consensus state correctly

* fix client example
  • Loading branch information
chengwenxi authored and fedekunze committed Oct 25, 2019
1 parent 102ab3d commit e048a6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion x/ibc/02-client/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func GetCmdUpdateClient(cdc *codec.Codec) *cobra.Command {
Long: strings.TrimSpace(fmt.Sprintf(`update existing client with a header:
Example:
$ %s tx ibc client create [client-id] [path/to/header.json] --from node0 --home ../node0/<app>cli --chain-id $CID
$ %s tx ibc client update [client-id] [path/to/header.json] --from node0 --home ../node0/<app>cli --chain-id $CID
`, version.ClientName),
),
Args: cobra.ExactArgs(2),
Expand Down
4 changes: 2 additions & 2 deletions x/ibc/02-client/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (k Keeper) SetClientType(ctx sdk.Context, clientID string, clientType expor
// GetConsensusState creates a new client state and populates it with a given consensus state
func (k Keeper) GetConsensusState(ctx sdk.Context, clientID string) (exported.ConsensusState, bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), k.prefix)
bz := store.Get(types.KeyClientState(clientID))
bz := store.Get(types.KeyConsensusState(clientID))
if bz == nil {
return nil, false
}
Expand All @@ -93,7 +93,7 @@ func (k Keeper) GetConsensusState(ctx sdk.Context, clientID string) (exported.Co
func (k Keeper) SetConsensusState(ctx sdk.Context, clientID string, consensusState exported.ConsensusState) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), k.prefix)
bz := k.cdc.MustMarshalBinaryLengthPrefixed(consensusState)
store.Set(types.KeyClientState(clientID), bz)
store.Set(types.KeyConsensusState(clientID), bz)
}

// GetVerifiedRoot gets a verified commitment Root from a particular height to
Expand Down

0 comments on commit e048a6c

Please sign in to comment.