Query: LastHeight -> Height :)

This commit is contained in:
Ethan Buchman 2017-02-14 17:21:21 -05:00
parent 67cf948f26
commit e4ec1a651f
5 changed files with 13 additions and 16 deletions

View File

@ -92,13 +92,13 @@ func cmdQuery(c *cli.Context) error {
val := resp.Value
proof := resp.Proof
lastHeight := resp.LastHeight
height := resp.Height
fmt.Println(string(wire.JSONBytes(struct {
Value []byte `json:"value"`
Proof []byte `json:"proof"`
LastHeight uint64 `json:"last_height"`
}{val, proof, lastHeight})))
Value []byte `json:"value"`
Proof []byte `json:"proof"`
Height uint64 `json:"height"`
}{val, proof, height})))
return nil
}

View File

@ -82,14 +82,14 @@ echo "... querying for packet data"
echo ""
# query for the packet data and proof
QUERY_RESULT=$(basecoin query ibc,egress,$CHAIN_ID1,$CHAIN_ID2,1)
LAST_HEIGHT=$(echo $QUERY_RESULT | jq .last_height)
HEIGHT=$(echo $QUERY_RESULT | jq .height)
PACKET=$(echo $QUERY_RESULT | jq .value)
PROOF=$(echo $QUERY_RESULT | jq .proof)
PACKET=$(removeQuotes $PACKET)
PROOF=$(removeQuotes $PROOF)
echo ""
echo "QUERY_RESULT: $QUERY_RESULT"
echo "LAST_HEIGHT: $LAST_HEIGHT"
echo "HEIGHT: $HEIGHT"
echo "PACKET: $PACKET"
echo "PROOF: $PROOF"
@ -102,9 +102,6 @@ sleep 5
waitForBlock localhost:46657
waitForBlock localhost:36657
# we need the header at height H=LAST_HEIGHT + 1
HEIGHT=$(($LAST_HEIGHT + 1))
echo ""
echo "... querying for block data"
echo ""

5
glide.lock generated
View File

@ -154,15 +154,14 @@ imports:
- transport
testImports:
- name: github.com/davecgh/go-spew
version: 346938d642f2ec3594ed81d874461961cd0faa76
version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9
subpackages:
- spew
- name: github.com/pmezard/go-difflib
version: 792786c7400a136282c1664665ae0a8db921c6c2
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
subpackages:
- difflib
- name: github.com/stretchr/testify
version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0
subpackages:
- assert
- require

View File

@ -13,9 +13,9 @@ import:
- package: github.com/tendermint/go-wire
version: develop
- package: github.com/tendermint/merkleeyes
version: last_height
version: develop
- package: github.com/tendermint/tendermint
version: last_height
version: rpc-commit
- package: github.com/tendermint/abci
version: develop
- package: github.com/gorilla/websocket

View File

@ -433,11 +433,12 @@ func verifyCommit(chainState BlockchainState, header *tm.Header, commit *tm.Comm
chainID := chainState.ChainID
vals := chainState.Validators
valSet := tm.NewValidatorSet(vals)
blockID := commit.Precommits[0].BlockID // XXX: incorrect
// NOTE: Currently this only works with the exact same validator set.
// Not this, but perhaps "ValidatorSet.VerifyCommitAny" should expose
// the functionality to verify commits even after validator changes.
blockID, err := valSet.VerifyCommitReturnBlockID(chainID, header.Height, commit)
err := valSet.VerifyCommit(chainID, blockID, header.Height, commit)
if err != nil {
return err
}