rpc: validate height in abci_query

This commit is contained in:
Ethan Buchman
2018-07-24 21:25:47 -04:00
parent 8dc655dad2
commit 082557b7d4

View File

@@ -1,10 +1,12 @@
package core
import (
"fmt"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/version"
cmn "github.com/tendermint/tendermint/libs/common"
)
// Query the application for some information.
@@ -48,6 +50,10 @@ import (
// | height | int64 | 0 | false | Height (0 means latest) |
// | trusted | bool | false | false | Does not include a proof of the data inclusion |
func ABCIQuery(path string, data cmn.HexBytes, height int64, trusted bool) (*ctypes.ResultABCIQuery, error) {
if height < 0 {
return nil, fmt.Errorf("height must be non-negative")
}
resQuery, err := proxyAppQuery.QuerySync(abci.RequestQuery{
Path: path,
Data: data,