-
Notifications
You must be signed in to change notification settings - Fork 73
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
get_raw_block api endpoint #820
Conversation
|
||
EOS_ASSERT( !params.block_num_or_id.empty() && params.block_num_or_id.size() <= 64, | ||
chain::block_id_type_exception, | ||
"Invalid Block number or ID, must be greater than 0 and less than 64 characters" |
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.
You have an extra equal to 64 checked while greater than 0 is not checked. This is not blocking. You can fix in RC.
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 believe the assertion condition is right but the message description was problematic, fixed in commit af1dcf2
std::optional<signed_block_header> header; | ||
|
||
if( block_num ) { | ||
header = db.fetch_block_header_by_number( *block_num ); |
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.
No try block for db.fetch_block_header_by_number
?
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.
The try you saw in the else was thrown from the type conversion from string
to block_id_type
, not from the fetch_block_header_by_id
itself. In this line, the block_num is already the right type; therefore, its not going to throw here. This is exactly the same logic with get_raw_block()
in line 1920.
This PR
/v1/chain/get_raw_block
: returns the raw block content without ABI decoding/v1/chain/get_block_header
: returns the block header with optional block extensionscleos get block
options for the added API endpoints above--raw
: corresponding toget_raw_block
--header
: corresponding toget_block_header
withinclude_extensions
set to false--header_with_extensions
: corresponding toget_block_header
withinclude_extensions
set to trueResolves #642