From 44bf69e5647890f264b49c1620635f831bd32bb3 Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Fri, 17 Aug 2018 00:16:17 -0700 Subject: [PATCH] run queries against cachewrapped commit state, not checkstate --- baseapp/baseapp.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 828414f1e2..365d7b31f2 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -374,7 +374,11 @@ func handleQueryCustom(app *BaseApp, path []string, req abci.RequestQuery) (res sdk.ErrUnknownRequest("No route for custom query specified").QueryResult() } querier := app.queryRouter.Route(path[1]) - ctx := app.checkState.ctx + if querier == nil { + sdk.ErrUnknownRequest(fmt.Sprintf("no custom querier found for route %s", path[1])).QueryResult() + } + + ctx := sdk.NewContext(app.cms.CacheMultiStore(), app.checkState.ctx.BlockHeader(), true, app.Logger) // Passes the rest of the path as an argument to the querier. // For example, in the path "custom/gov/proposal/test", the gov querier gets []string{"proposal", "test"} as the path resBytes, err := querier(ctx, path[2:], req)