Extra safe we do not write during the query

This commit is contained in:
Ethan Frey 2020-10-07 14:45:23 +02:00
parent 9593e91eea
commit aabe0b6287
1 changed files with 4 additions and 1 deletions

View File

@ -260,7 +260,10 @@ func getAccumulatedRewards(ctx sdk.Context, distKeeper distribution.Keeper, dele
return nil, err
}
req := abci.RequestQuery{Data: data}
qres, err := distribution.NewQuerier(distKeeper)(ctx, []string{distribution.QueryDelegationRewards}, req)
// just to be safe... ensure we do not accidentally write in the querier (which does some funky things)
cache, _ := ctx.CacheContext()
qres, err := distribution.NewQuerier(distKeeper)(cache, []string{distribution.QueryDelegationRewards}, req)
if err != nil {
return nil, err
}