Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is how it's supposed to work. Apparently in this API, this request queries for the blocks between
[offset, offset + numberOfBlocksPerRequest]
. In this caseoffset
starts atstartHeight
and keeps increasing bynumberOfBlocksPerRequest
on each iteration until it reaches the end.So no change to this call is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rootulp can confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rach-id thank you for your feedback! I see your point, but I’d like to clarify why I believe this change is necessary:
The current implementation assumes that
offset
always starts atstartHeight
and increments bynumberOfBlocksPerRequest
. However, ifoffset
isn't explicitly reset to account forstartHeight
, it can lead to incorrect behavior in scenarios wherestartHeight
is modified dynamically or when the API is used in a context whereoffset
doesn’t align perfectly withstartHeight
.My change ensures that the calculation explicitly accounts for
startHeight
, guaranteeing that the query starts from the intended block range every time. Without this adjustment, there’s a risk of missing or duplicating blocks in edge cases, especially when the API is reused with varyingstartHeight
values.I’d love to hear your thoughts on this and can provide additional examples if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see when or how this can happen. The script works as-is. We want to include blocks starting at start height and querying 100 blocks each time.