Skip to content

Commit

Permalink
Fix query header and node-state cli cmds (#192)
Browse files Browse the repository at this point in the history
* fix cli header cmd and node-state

* fix bug

* changelog
  • Loading branch information
colin-axner committed May 24, 2021
1 parent c24f60c commit 4570955
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (modules/light-clients/06-solomachine) [\153](https://github.com/cosmos/ibc-go/pull/153) Fix solo machine proof height sequence mismatch bug.
* (02-client) [\#192](https://github.com/cosmos/ibc-go/pull/192) Fix IBC `query ibc client header` cli command. Support historical queries for query header/node-state commands.
* (modules/light-clients/06-solomachine) [\#153](https://github.com/cosmos/ibc-go/pull/153) Fix solo machine proof height sequence mismatch bug.
* (modules/light-clients/06-solomachine) [\#122](https://github.com/cosmos/ibc-go/pull/122) Fix solo machine merkle prefix casting bug.
* (modules/light-clients/06-solomachine) [\#120](https://github.com/cosmos/ibc-go/pull/120) Fix solo machine handshake verification bug.

Expand Down
16 changes: 13 additions & 3 deletions modules/core/02-client/client/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,19 @@ func QueryTendermintHeader(clientCtx client.Context) (ibctmtypes.Header, int64,
return ibctmtypes.Header{}, 0, err
}

height := info.Response.LastBlockHeight
var height int64
if clientCtx.Height != 0 {
height = clientCtx.Height
} else {
height = info.Response.LastBlockHeight
}

commit, err := node.Commit(context.Background(), &height)
if err != nil {
return ibctmtypes.Header{}, 0, err
}

page := 0
page := 1
count := 10_000

validators, err := node.Validators(context.Background(), &height, &page, &count)
Expand Down Expand Up @@ -173,7 +178,12 @@ func QueryNodeConsensusState(clientCtx client.Context) (*ibctmtypes.ConsensusSta
return &ibctmtypes.ConsensusState{}, 0, err
}

height := info.Response.LastBlockHeight
var height int64
if clientCtx.Height != 0 {
height = clientCtx.Height
} else {
height = info.Response.LastBlockHeight
}

commit, err := node.Commit(context.Background(), &height)
if err != nil {
Expand Down

0 comments on commit 4570955

Please sign in to comment.