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 val := resp.Value
proof := resp.Proof proof := resp.Proof
lastHeight := resp.LastHeight height := resp.Height
fmt.Println(string(wire.JSONBytes(struct { fmt.Println(string(wire.JSONBytes(struct {
Value []byte `json:"value"` Value []byte `json:"value"`
Proof []byte `json:"proof"` Proof []byte `json:"proof"`
LastHeight uint64 `json:"last_height"` Height uint64 `json:"height"`
}{val, proof, lastHeight}))) }{val, proof, height})))
return nil return nil
} }

View File

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

5
glide.lock generated
View File

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

View File

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

View File

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