minor things
This commit is contained in:
parent
b21081c83a
commit
d48c819207
|
@ -201,12 +201,12 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC
|
||||||
// Implements ABCI.
|
// Implements ABCI.
|
||||||
// Delegates to CommitMultiStore if it implements Queryable
|
// Delegates to CommitMultiStore if it implements Queryable
|
||||||
func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
|
func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
|
||||||
query, ok := app.cms.(sdk.Queryable)
|
queryable, ok := app.cms.(sdk.Queryable)
|
||||||
if !ok {
|
if !ok {
|
||||||
msg := "application doesn't support queries"
|
msg := "application doesn't support queries"
|
||||||
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
|
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
|
||||||
}
|
}
|
||||||
return query.Query(req)
|
return queryable.Query(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements ABCI.
|
// Implements ABCI.
|
||||||
|
|
|
@ -191,6 +191,10 @@ func (rs *rootMultiStore) getStoreByName(name string) Store {
|
||||||
|
|
||||||
//---------------------- Query ------------------
|
//---------------------- 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 {
|
func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery {
|
||||||
// Query just routes this to a substore.
|
// Query just routes this to a substore.
|
||||||
path := req.Path
|
path := req.Path
|
||||||
|
@ -204,7 +208,7 @@ func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery {
|
||||||
msg := fmt.Sprintf("no such store: %s", storeName)
|
msg := fmt.Sprintf("no such store: %s", storeName)
|
||||||
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
|
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
|
||||||
}
|
}
|
||||||
query, ok := store.(Queryable)
|
queryable, ok := store.(Queryable)
|
||||||
if !ok {
|
if !ok {
|
||||||
msg := fmt.Sprintf("store %s doesn't support queries", storeName)
|
msg := fmt.Sprintf("store %s doesn't support queries", storeName)
|
||||||
return sdk.ErrUnknownRequest(msg).Result().ToQuery()
|
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
|
// trim the path and make the query
|
||||||
req.Path = subpath
|
req.Path = subpath
|
||||||
res := query.Query(req)
|
res := queryable.Query(req)
|
||||||
|
|
||||||
// Note: later we have to think about adding information about
|
|
||||||
// the multistore -> store path to the proof
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue