Skip to content

Commit 2724daf

Browse files
committed
query refactor
1 parent b2c33d0 commit 2724daf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

challenger/query.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ func (c *Challenger) QueryChallenges(from string, limit uint64, descOrder bool)
1414

1515
count := uint64(0)
1616
fetchFn := func(key, value []byte) (bool, error) {
17+
if count >= limit {
18+
next = base64.StdEncoding.EncodeToString(key)
19+
return true, nil
20+
}
1721
challenge := challengertypes.Challenge{}
1822
err = challenge.Unmarshal(value)
1923
if err != nil {
2024
return true, err
2125
}
22-
if count >= limit {
23-
next = base64.StdEncoding.EncodeToString(challengertypes.PrefixedChallenge(challenge.Time, challenge.Id))
24-
return true, nil
25-
}
26-
challenges = append(challenges, challenge)
2726
count++
27+
challenges = append(challenges, challenge)
2828
return false, nil
2929
}
3030

0 commit comments

Comments
 (0)