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

All numbers in Addr are ints #1

Closed
matthieu opened this issue Jan 22, 2016 · 4 comments
Closed

All numbers in Addr are ints #1

matthieu opened this issue Jan 22, 2016 · 4 comments
Assignees

Comments

@matthieu
Copy link

For blockchains with large amounts (cough dogecoin cough) or very large or active wallets, total received, sent or balance can overflow an int. Someday, even NumTx could.

@acityinohio
Copy link
Contributor

Ah good call. And also, classic dogecoin. Wish there was an int128 type...I guess Big Int is the answer? https://golang.org/pkg/math/big/

@matthieu
Copy link
Author

uint64 should be enough, faster and much easier to manipulate.

@acityinohio
Copy link
Contributor

👍 I'll probably keep a few things as ints (off the top of my head, unconfirmed_balance because negatives are possible and should never be very big)

@acityinohio acityinohio self-assigned this Jan 22, 2016
@acityinohio
Copy link
Contributor

JIC anyone is following this, @matthieu and I talked in meatspace and agreed that this came down to a 32-bit vs 64-bit issue (since Go 1.1 the size of the int type is based on the underlying architecture). For almost all cases, 64-bit ints should be fine (except in super weird/pathological cases and/or potentially dogecoin 🐶), and keeping the type as int reduces a fair amount of cognitive overhead. We're going to add specific warnings/suggestions for those who are on 32-bit systems in the README and godoc.

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

No branches or pull requests

2 participants