Skip to content

Commit

Permalink
address other comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnya97 committed Nov 4, 2018
1 parent eeff820 commit 327f7e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions x/stake/keeper/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (k Keeper) GetDelegation(ctx sdk.Context,
return delegation, true
}

// return all delegations to a specific validator. Useful for querier.
// return all delegations used during genesis dump
func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegation) {
store := ctx.KVStore(k.storeKey)
iterator := sdk.KVStorePrefixIterator(store, DelegationKey)
Expand All @@ -37,8 +37,8 @@ func (k Keeper) GetAllDelegations(ctx sdk.Context) (delegations []types.Delegati
return delegations
}

// return all delegations used during genesis dump
func (k Keeper) GetAllDelegationsToValidator(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []types.Delegation) {
// return all delegations to a specific validator. Useful for querier.
func (k Keeper) GetValidatorDelegations(ctx sdk.Context, valAddr sdk.ValAddress) (delegations []types.Delegation) {
store := ctx.KVStore(k.storeKey)
iterator := sdk.KVStorePrefixIterator(store, DelegationKey)
defer iterator.Close()
Expand Down
2 changes: 1 addition & 1 deletion x/stake/querier/queryable.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func queryValidatorDelegations(ctx sdk.Context, cdc *codec.Codec, req abci.Reque
return []byte{}, sdk.ErrUnknownAddress("")
}

delegations := k.GetAllDelegationsToValidator(ctx, params.ValidatorAddr)
delegations := k.GetValidatorDelegations(ctx, params.ValidatorAddr)

res, errRes = codec.MarshalJSONIndent(cdc, delegations)
if errRes != nil {
Expand Down

0 comments on commit 327f7e1

Please sign in to comment.