Browse Source

rpc: validate height in abci_query

pull/2056/head
Ethan Buchman 6 years ago
parent
commit
082557b7d4
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      rpc/core/abci.go

+ 7
- 1
rpc/core/abci.go View File

@ -1,10 +1,12 @@
package core package core
import ( import (
"fmt"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
ctypes "github.com/tendermint/tendermint/rpc/core/types" ctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/tendermint/tendermint/version" "github.com/tendermint/tendermint/version"
cmn "github.com/tendermint/tendermint/libs/common"
) )
// Query the application for some information. // Query the application for some information.
@ -48,6 +50,10 @@ import (
// | height | int64 | 0 | false | Height (0 means latest) | // | height | int64 | 0 | false | Height (0 means latest) |
// | trusted | bool | false | false | Does not include a proof of the data inclusion | // | 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) { 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{ resQuery, err := proxyAppQuery.QuerySync(abci.RequestQuery{
Path: path, Path: path,
Data: data, Data: data,


Loading…
Cancel
Save