Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query header and node-state cli cmds #192

Merged
merged 6 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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