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

Prevent all threads from using the same POW nonce. #525

Closed
penguins-cymbals opened this issue Oct 20, 2016 · 5 comments
Closed

Prevent all threads from using the same POW nonce. #525

penguins-cymbals opened this issue Oct 20, 2016 · 5 comments

Comments

@penguins-cymbals
Copy link

GolosChain#37

Not sure how to issue the pull request cross-chains, but anyways, the same thing applies to steemit.

The nonce should be different for each thread, otherwise all threads are performing the exact same hash, which means effectively on a machine with N cores you were only actually performing 1 core's worth of work.
This should hopefully bring back some fairness in mining.

Since I'm giving up my unfair advantage, I hope this comes with a bug bounty from steemit and/or golos. Please PM 'penguin' in golos or steemit chat if so, so I can say where to issue it. :)

@abitmore
Copy link
Contributor

abitmore commented Oct 20, 2016

Threads aren't using same nounces, see this line of code: https://github.com/steemit/steem/blob/v0.14.2/libraries/plugins/witness/witness.cpp#L491 .
Simply, hash rate should be higher if mining-threads in config.ini set to more than 1 and if the machine has more than 1 core.

//Edit: my bad.. just checked the PR. Stupid bug.

@penguins-cymbals
Copy link
Author

thread_num is never changed in the current code base, it is always 0.

@abitmore
Copy link
Contributor

You're right. It's introduced in this commit: 42e95ba#diff-76b4b57a464fcf6ec0c0525753ed1222L587

@arhag
Copy link
Contributor

arhag commented Oct 21, 2016

@abitmore: Actually the bug was first introduced with this commit: 581317f#diff-76b4b57a464fcf6ec0c0525753ed1222

mvandeberg pushed a commit that referenced this issue Oct 21, 2016
mvandeberg pushed a commit that referenced this issue Oct 21, 2016
@theoreticalbts
Copy link
Contributor

Fixed, merged.

This was referenced Oct 28, 2016
On1x pushed a commit to VIZ-Blockchain/viz-cpp-node that referenced this issue May 28, 2018
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

4 participants