Skip to content

Commit

Permalink
fix: tzkt api may return more delegators than numDelegators
Browse files Browse the repository at this point in the history
See tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki at cycle 751 for an example

https://api.tzkt.io/v1/rewards/split/tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki/751?offset=0&limit=10000
  • Loading branch information
TPXP committed Jul 2, 2024
1 parent 1b69468 commit 2f6a6e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tzkt/tzkt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def get_reward_split(self, address, cycle, fetch_delegators=True) -> dict:
assert isinstance(res, dict) and "delegators" in res
res["delegators"].extend(page["delegators"])

if not fetch_delegators or len(res["delegators"]) == res["numDelegators"]:
if not fetch_delegators or len(res["delegators"]) >= res["numDelegators"] or len(page["delegators"]) == 0:
return res
else:
offset += limit
Expand Down

0 comments on commit 2f6a6e5

Please sign in to comment.