Cosmos-sdk: empty rewards returns null

Created on 21 Feb 2019  Â·  5Comments  Â·  Source: cosmos/cosmos-sdk

Summary of Bug

empty rewards from GET distribution/delegators/{delegatorAddress}/rewards should return [] instead of null


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
CLI REST bug distribution

Most helpful comment

Yeah I remember making a comment about this during the distribution REST/CLI PR. It's fixable, we just need some custom result handling logic -- nothing major.

All 5 comments

It also crashes for empty validator rewards:

GET distribution/delegators/{delegatorAddress}/rewards/{validatorAddress}

{"message":"ABCIQuery: Response error: RPC error -32603 - Internal error: runtime error: invalid memory address or nil pointer dereference"}

Yeah I remember making a comment about this during the distribution REST/CLI PR. It's fixable, we just need some custom result handling logic -- nothing major.

@fedekunze Are there any other endpoints that exhibit this behavior? I would imagine yes. Ideally we fix all these in 1 PR. Also should it return a 404 instead of []?

I think [] needs less logic client side to handle the response.

@faboweb what you're describing was fixed in #4047.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faboweb picture faboweb  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

adrianbrink picture adrianbrink  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

hendrikhofstadt picture hendrikhofstadt  Â·  3Comments