-
Notifications
You must be signed in to change notification settings - Fork 679
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]replacement the abs() with unsigned_abs() #4921
[fix]replacement the abs() with unsigned_abs() #4921
Conversation
@maldiohead can you rebase against develop and we'll take a look? |
455f1eb
to
f3206f3
Compare
@wileyj Hey, I have rebase to the develop branch |
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.
We should search and see if abs()
is used elsewhere in the code also
Signed-off-by: maldiohead <[email protected]>
3d9f21b
to
192f758
Compare
this is interesting - the docker image part of ci (which is a required check before merge) is choking on the parentheses. 2 options @maldiohead - you'll either need to adjust your branch name (basically remove the parentheses), or i can poke around the ci workflow, maybe there's substitution i can do on the branch name before building an image. the first option would be faster to merge this, but the second option is probably needed regardless. |
abs() may be lead to panic in the debug mode and optimized code will return i64::MIN without a panic. so need use unsigned_abs() in here
Description
The absolute value of i64::MIN cannot be represented as an i64, and attempting to calculate it will cause an overflow. This means that code in debug mode will trigger a panic on this case and optimized code will return i64::MIN without a panic. so
in here need replace abs() with unsigned_abs()
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yaml
andrpc-endpoints.md
for v2 endpoints,event-dispatcher.md
for new events)clarity-benchmarking
repobitcoin-tests.yml