Skip to content

Commit

Permalink
Fix: possible off-by-1 error (#157)
Browse files Browse the repository at this point in the history
When the big maps are all in the same level, using `i + 1` at the end when passing the tuple is missing the last member because i stops at `len - 1`. A 16 length big map event was returning 0 - 14 instead of 0 - 15.

I just added 1 in the final case and it fixed the issue on my end. I'm not sure if there are any side-effects here.
  • Loading branch information
arrijabba authored Oct 10, 2021
1 parent 285c8d6 commit 5b2ba98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dipdup/datasources/tzkt/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async def fetch_big_maps_by_level(self) -> AsyncGenerator[Tuple[int, Tuple[BigMa
offset += self._datasource.request_limit

if big_maps:
yield big_maps[0].level, tuple(big_maps[: i + 1])
yield big_maps[0].level, tuple(big_maps[: i + 2])


class TzktDatasource(IndexDatasource):
Expand Down

0 comments on commit 5b2ba98

Please sign in to comment.