Skip to content

Commit

Permalink
chore: Handle accounts with zero staking balance on rewards endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrsirdev committed Oct 20, 2023
1 parent 01c72ed commit 80bab36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

## Unreleased

- (chore) [fse-792] Handle accounts with zero staking balance on rewards endpoint
- (chore) [fse-710] Bundle all price cron API calls into a single API call for all tokens
- (chore) [fse-710] Fetch evmos 24h price change and return it on the ERC20ModuleBalance endpoint

Expand Down
7 changes: 6 additions & 1 deletion api/handler/v1/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package v1
import (
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"math/big"
"sort"
Expand Down Expand Up @@ -757,8 +758,12 @@ func Rewards(ctx *fasthttp.RequestCtx) {
length = len(sortedRewards)
}

msgs := make([]sdk.Msg, length)
if len(sortedRewards) <= 0 {

Check failure on line 761 in api/handler/v1/transaction.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

sloppyLen: len(sortedRewards) <= 0 can be len(sortedRewards) == 0 (gocritic)
sendResponse("account does not have staking balance", errors.New(""), ctx)
return
}

msgs := make([]sdk.Msg, length)
for k, v := range sortedRewards {
if k > 6 {
break
Expand Down

0 comments on commit 80bab36

Please sign in to comment.