Skip to content

Commit

Permalink
fix kvstore access for gridnode undelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
dekm committed Mar 18, 2024
1 parent 3d87967 commit 63fd1c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion x/gridnode/keeper/query_unobonding_amount.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"encoding/json"

"cosmossdk.io/store/prefix"
"github.com/cosmos/cosmos-sdk/runtime"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/unigrid-project/cosmos-gridnode/x/gridnode/types"
"google.golang.org/grpc/codes"
Expand All @@ -27,8 +29,10 @@ func (k Keeper) UnbondingEntries(goCtx context.Context, req *types.QueryUnbondin
key := k.keyForUnBonding(delegatorAddr)

// Retrieve the value from the store
store := ctx.KVStore(k.storeKey)
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, []byte(types.StoreKey))
bz := store.Get(key)

if bz == nil {
// Return an empty list if no unbonding entries are found for the delegator
return &types.QueryUnbondingEntriesResponse{UnbondingEntries: nil}, nil
Expand Down

0 comments on commit 63fd1c0

Please sign in to comment.