Skip to content

Commit

Permalink
query refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cha committed Dec 10, 2024
1 parent b2c33d0 commit 2724daf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions challenger/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ func (c *Challenger) QueryChallenges(from string, limit uint64, descOrder bool)

count := uint64(0)
fetchFn := func(key, value []byte) (bool, error) {
if count >= limit {
next = base64.StdEncoding.EncodeToString(key)
return true, nil
}
challenge := challengertypes.Challenge{}
err = challenge.Unmarshal(value)
if err != nil {
return true, err
}
if count >= limit {
next = base64.StdEncoding.EncodeToString(challengertypes.PrefixedChallenge(challenge.Time, challenge.Id))
return true, nil
}
challenges = append(challenges, challenge)
count++
challenges = append(challenges, challenge)
return false, nil
}

Expand Down

0 comments on commit 2724daf

Please sign in to comment.