-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core/rawdb: add logging and fix comments around AncientRange function. #28379
core/rawdb: add logging and fix comments around AncientRange function. #28379
Conversation
} | ||
// The data is on the order [h, h+1, .., n] -- reordering needed | ||
for i := range data { | ||
rlpHeaders = append(rlpHeaders, data[len(data)-1-i]) |
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.
Can you elaborate what's the difference between the old and new logic?
In the old code, ancient headers are reordered/appended only if they are all loaded
In the new code, the logic is same?
Btw, I think we can use max=0
to un-specify the size limit. As function description says,
This method assumes that the caller already has placed a cap on count, to prevent DoS issues.
, we don't need to worry about the size overflow issue.
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.
Yes, I didn't change the logic, just added logging errors in case AncientRange
fails and logging warnings in case AncientRange reads less than requested count
.
Thank you for clarifying that it is ok to use max=0
here.
I will update the PR.
ethereum#28379) This adds warning logs when the read does not match the expected count. We can also remove the size limit since the function documentation explicitly states that callers should limit the count.
…function. (ethereum#28379)" This reverts commit f81a9f3.
…function. (ethereum#28379)" This reverts commit f81a9f3.
ethereum#28379) This adds warning logs when the read does not match the expected count. We can also remove the size limit since the function documentation explicitly states that callers should limit the count.
ethereum#28379) This adds warning logs when the read does not match the expected count. We can also remove the size limit since the function documentation explicitly states that callers should limit the count.
This PR adds logging and fixes some comments around the
AncientRange
function. Addresses #27667.