Merge PR #4895: Lite Client Query Height Fix

This commit is contained in:
Alexander Bezobchuk
2019-08-13 09:13:34 -04:00
committed by GitHub
parent 436f440e8f
commit 46c98d396d
3 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -74,13 +74,19 @@ func (ctx CLIContext) GetFromName() string {
// query performs a query to a Tendermint node with the provided store name
// and path. It returns the result and height of the query upon success
// or an error if the query fails.
// or an error if the query fails. In addition, it will verify the returned
// proof if TrustNode is disabled. If proof verification fails or the query
// height is invalid, an error will be returned.
func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, height int64, err error) {
node, err := ctx.GetNode()
if err != nil {
return res, height, err
}
if ctx.Height <= 1 && !ctx.TrustNode {
return res, height, errors.New("cannot query with proof when height <= 1; please provide a valid height")
}
opts := rpcclient.ABCIQueryOptions{
Height: ctx.Height,
Prove: !ctx.TrustNode,