Merge PR #4905: Various Height Query Fixes
This commit is contained in:
parent
f1adb7afd9
commit
9adb398e18
|
@ -69,6 +69,10 @@ longer panics if the store to load contains substores that we didn't explicitly
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* (baseapp) \#4903 Various height query fixes:
|
||||||
|
* Move height with proof check from `CLIContext` to `BaseApp` as the height
|
||||||
|
can automatically be injected there.
|
||||||
|
* Update `handleQueryStore` to resemble `handleQueryCustom`
|
||||||
* (cli) [\#4763](https://github.com/cosmos/cosmos-sdk/issues/4763) Fix flag `--min-self-delegation` for staking `EditValidator`
|
* (cli) [\#4763](https://github.com/cosmos/cosmos-sdk/issues/4763) Fix flag `--min-self-delegation` for staking `EditValidator`
|
||||||
* (keys) Fix ledger custom coin type support bug
|
* (keys) Fix ledger custom coin type support bug
|
||||||
|
|
||||||
|
|
|
@ -581,6 +581,15 @@ func handleQueryStore(app *BaseApp, path []string, req abci.RequestQuery) abci.R
|
||||||
|
|
||||||
req.Path = "/" + strings.Join(path[1:], "/")
|
req.Path = "/" + strings.Join(path[1:], "/")
|
||||||
|
|
||||||
|
// when a client did not provide a query height, manually inject the latest
|
||||||
|
if req.Height == 0 {
|
||||||
|
req.Height = app.LastBlockHeight()
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.Height <= 1 && req.Prove {
|
||||||
|
return sdk.ErrInternal("cannot query with proof when height <= 1; please provide a valid height").QueryResult()
|
||||||
|
}
|
||||||
|
|
||||||
resp := queryable.Query(req)
|
resp := queryable.Query(req)
|
||||||
resp.Height = req.Height
|
resp.Height = req.Height
|
||||||
|
|
||||||
|
@ -631,6 +640,10 @@ func handleQueryCustom(app *BaseApp, path []string, req abci.RequestQuery) (res
|
||||||
req.Height = app.LastBlockHeight()
|
req.Height = app.LastBlockHeight()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.Height <= 1 && req.Prove {
|
||||||
|
return sdk.ErrInternal("cannot query with proof when height <= 1; please provide a valid height").QueryResult()
|
||||||
|
}
|
||||||
|
|
||||||
cacheMS, err := app.cms.CacheMultiStoreWithVersion(req.Height)
|
cacheMS, err := app.cms.CacheMultiStoreWithVersion(req.Height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sdk.ErrInternal(
|
return sdk.ErrInternal(
|
||||||
|
|
|
@ -83,10 +83,6 @@ func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, height i
|
||||||
return res, height, err
|
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{
|
opts := rpcclient.ABCIQueryOptions{
|
||||||
Height: ctx.Height,
|
Height: ctx.Height,
|
||||||
Prove: !ctx.TrustNode,
|
Prove: !ctx.TrustNode,
|
||||||
|
|
Loading…
Reference in New Issue