Fix query validator UBDs (#7228)
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
979e8144fb
commit
da7a8e603f
|
@ -133,9 +133,13 @@ func (k Querier) ValidatorUnbondingDelegations(c context.Context, req *types.Que
|
|||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
ubdStore := prefix.NewStore(store, types.GetUBDsByValIndexKey(req.ValidatorAddr))
|
||||
srcValPrefix := types.GetUBDsByValIndexKey(req.ValidatorAddr)
|
||||
ubdStore := prefix.NewStore(store, srcValPrefix)
|
||||
pageRes, err := query.Paginate(ubdStore, req.Pagination, func(key []byte, value []byte) error {
|
||||
ubd, err := types.UnmarshalUBD(k.cdc, value)
|
||||
storeKey := types.GetUBDKeyFromValIndexKey(append(srcValPrefix, key...))
|
||||
storeValue := store.Get(storeKey)
|
||||
|
||||
ubd, err := types.UnmarshalUBD(k.cdc, storeValue)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -706,6 +706,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryValidatorUnbondingDelegations() {
|
|||
suite.NoError(err)
|
||||
suite.Equal(uint64(1), res.Pagination.Total)
|
||||
suite.Equal(1, len(res.UnbondingResponses))
|
||||
suite.Equal(res.UnbondingResponses[0].ValidatorAddress, val1.GetOperator())
|
||||
} else {
|
||||
suite.Error(err)
|
||||
suite.Nil(res)
|
||||
|
|
Loading…
Reference in New Issue