-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix(rest-api): Avoid panic in append_info_headers #4178
base: develop
Are you sure you want to change the base?
Conversation
crates/iota-rest-api/src/response.rs
Outdated
*checkpoint.sequence_number(), | ||
checkpoint.timestamp_ms, | ||
), | ||
Err(_) => (0, 0, 0), |
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.
Instead of ignoring the error, it might be better to return it from this function. Overriding the error with (0,0,0) doesn't seem good to me, also because it might be an important error from the state reader.
crates/iota-rest-api/src/response.rs
Outdated
pub enum HeaderError { | ||
InternalServerError(String), | ||
} |
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 am not very sure whether it is necessary to introduce a new HeaderError
, or maybe you can just use the RestError
defined in the iota-rest-api
crate?
It seems that this issue was already fixed in the upstream. They just ignore the header if the corresponding object is not found instead of failing with internal server error. |
Description of change
The REST API might cause the node to panic if
append_info_headers
fails to retrieve the data. This PR updatesappend_info_headers
to return an internal server error when it fails.Links to any relevant issues
Close #4087
Type of change
Change checklist