minor things

This commit is contained in:
Ethan Buchman 2018-02-06 17:18:22 -05:00
parent b21081c83a
commit d48c819207
2 changed files with 8 additions and 7 deletions

View File

@ -201,12 +201,12 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC
// Implements ABCI.
// Delegates to CommitMultiStore if it implements Queryable
func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
query, ok := app.cms.(sdk.Queryable)
queryable, ok := app.cms.(sdk.Queryable)
if !ok {
msg := "application doesn't support queries"
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
}
return query.Query(req)
return queryable.Query(req)
}
// Implements ABCI.

View File

@ -191,6 +191,10 @@ func (rs *rootMultiStore) getStoreByName(name string) Store {
//---------------------- Query ------------------
// Query calls substore.Query with the same `req` where `req.Path` is
// modified to remove the substore prefix.
// Ie. `req.Path` here is `/<substore>/<path>`, and trimmed to `/<path>` for the substore.
// TODO: add proof for `multistore -> substore`.
func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery {
// Query just routes this to a substore.
path := req.Path
@ -204,7 +208,7 @@ func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery {
msg := fmt.Sprintf("no such store: %s", storeName)
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
}
query, ok := store.(Queryable)
queryable, ok := store.(Queryable)
if !ok {
msg := fmt.Sprintf("store %s doesn't support queries", storeName)
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
@ -212,10 +216,7 @@ func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery {
// trim the path and make the query
req.Path = subpath
res := query.Query(req)
// Note: later we have to think about adding information about
// the multistore -> store path to the proof
res := queryable.Query(req)
return res
}