Skip to content
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: remove unnecessary coin usage #7390

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thecockatiel
Copy link
Contributor

It seems to be unnecessary
if it's not, can you explain, so we can add a comment for it ?

HenrikJannsen
HenrikJannsen previously approved these changes Feb 15, 2025
Copy link
Collaborator

@HenrikJannsen HenrikJannsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link
Contributor

@alvasw alvasw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the developer wanted to handle unsigned integers correctly because the protobuf definition of AccountingTxOutput.value is a uint32 (unsigned integer) [1]. Java doesn't natively support unsigned integer and therefore we need to use the datatype long. Before persisting the data we need to convert the long back to an unsigned integer. The conversion is wrong here but it doesn't cause any bugs in this case.

2147483647 equals to Coin.valueOf(2147483647).getValue(). Could you please replace 2147483647 with Integer.MAX_VALUE and change the second argument to "We only support integer values in protobuf storage for the amount." to make the code more readable? Thank you!

[1]

uint32 value = 1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants