-
Notifications
You must be signed in to change notification settings - Fork 220
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: u64->i64->u64 conversion; chain split height as u64 #3442
Conversation
@@ -326,15 +326,15 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer { | |||
|
|||
let headers: Vec<u64> = if request.from_height != 0 { | |||
match sorting { | |||
Sorting::Desc => ((cmp::max(0, request.from_height as i64 - num_headers as i64 + 1) as u64)..= | |||
Sorting::Desc => (cmp::max(0, request.from_height - num_headers + 1)..= |
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.
Is there not a chance for an underflow here?
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.
This needs a covering test, even if this logic is moved into a function.
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.
should this then be
let headers: Vec<u64> = if request.from_height >= num_headers {
num_headers is forced to be between 10 and 10_000
Means that from_height being 0 would go to the else
Or is it more desirable to check the underflow flag with overflowing_sub() ?
Seems you need to run cargo fmt |
* development: fix: fix confusing names in get_balance functions (tari-project#3447) feat: add sql query to obtain balance (tari-project#3446) fix: u64->i64->u64 conversion; chain split height as u64 (tari-project#3442)
Description
removing an unnecessary conversion and using u64 for chain height
How Has This Been Tested?
rust build & test