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

Estimated time to produce becomes negative when target >= 31 #9

Closed
arhag opened this issue Apr 18, 2016 · 1 comment
Closed

Estimated time to produce becomes negative when target >= 31 #9

arhag opened this issue Apr 18, 2016 · 1 comment

Comments

@arhag
Copy link
Contributor

arhag commented Apr 18, 2016

The problem is with this line:

auto hashes = 1 << bits;

At least in my compiler (gcc), 1 << bits assumes a 32-bit signed integer, so when bits == 31, hashes becomes a negative number.

The easiest fix is to replace the line with:
auto hashes = 1ULL << bits;

I tried this and it worked on my computer. But this is only a temporary fix because if the mining queue becomes long enough (I think over 231) then this fix will also break. Perhaps the mining queue is unlikely to get that long and this is a good enough fix. Or maybe you guys want to come up with a more robust solution.

@arhag
Copy link
Contributor Author

arhag commented Apr 20, 2016

I see you fixed this bug with commit 38e456e.

I will close this issue now.

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

1 participant