From 2f6a6e5b08b03a5c503c6763b18930b5ba0f8928 Mon Sep 17 00:00:00 2001 From: "Thomas P." Date: Tue, 2 Jul 2024 11:25:29 +0200 Subject: [PATCH] fix: tzkt api may return more delegators than numDelegators See tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki at cycle 751 for an example https://api.tzkt.io/v1/rewards/split/tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki/751?offset=0&limit=10000 --- src/tzkt/tzkt_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tzkt/tzkt_api.py b/src/tzkt/tzkt_api.py index aa1dc46a..931b2c5f 100644 --- a/src/tzkt/tzkt_api.py +++ b/src/tzkt/tzkt_api.py @@ -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