-
Notifications
You must be signed in to change notification settings - Fork 990
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
Foreign API: Bulk block request #3751
Foreign API: Bulk block request #3751
Conversation
Tested and ready for review, note there's a hardcoded max of 1000 blocks, similar to the existing max in /// Returns a |
|
|
||
match block_res { | ||
Err(e) => { | ||
if let Error::NotFound = e { |
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.
As I understand it, we'll skip blocks we can't find, which is ok, but do we expect to arrive at this state for some blocks or is it just defensive programming?
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 there's a particular guarantee that there won't be gaps in the stored blocks, so no harm just handling the case.
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.
Only left a minor question, other than that the code looks good to me. I am unable to test it at the moment, but have asked a few days ago vegycslol to do it and he confirmed it works for him on a non-archive node.
* remove non-mainnet check for PIBD requests * add first version of get blocks function * .\api\src\foreign.rs * add a max value to get_blocks, documentation
As requested, a foreign API function that returns a number of blocks (if they exist) based on the height at which they were applied.
Note this is WIP and subject to review and change, and we may need some form of limitation here to avoid an obvious DOS vector.