Merge PR #4382: Support height queries for queriers

This commit is contained in:
Alexander Bezobchuk
2019-05-28 20:58:33 -04:00
committed by GitHub
parent 61d0f888b7
commit 8b1d75caa2
11 changed files with 309 additions and 31 deletions
+9
View File
@@ -536,6 +536,15 @@ func handleQueryCustom(app *BaseApp, path []string, req abci.RequestQuery) (res
app.cms.CacheMultiStore(), app.checkState.ctx.BlockHeader(), true, app.logger,
).WithMinGasPrices(app.minGasPrices)
if req.Height > 0 {
cacheMS, err := app.cms.CacheMultiStoreWithVersion(req.Height)
if err != nil {
return sdk.ErrInternal(fmt.Sprintf("failed to load state at height %d; %s", req.Height, err)).QueryResult()
}
ctx = ctx.WithMultiStore(cacheMS)
}
// 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