-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Pow: Refactor: Encapsulate miner-related pow in GenerateProof (was ScanHash) and use it for regtest mining #4793
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
Conversation
69edb4f to
c4c4b5a
Compare
|
Closing as it is included in #4794 with only one commit more. |
|
Reopened as independent from #4506 |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4793_cf07ea708c5822687ea9ef9c70a37324843a43b4/ for binaries and test log. |
src/miner.cpp
Outdated
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.
Why turn this into a global? It's ugly, and I don't think it will actually work in case of multiple hasher threads...
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.
I don't know of any other way to encapsulate the hashmeter inside the function (which will later be a method of CProof). I already asked this and nobody answered, but would anyone oppose to just removing the hashmeter? It would be simpler and cleaner.
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.
Internal miner should only be used for testing, so I vote to simplify and remove the hash meter.
|
@gavinandresen that's the reason why I wanted to get rid of the optimization (which doesn't really help much in regtest mode) in #4423 but I'm happy removing the hashmeter. |
72dd03d to
0810550
Compare
|
The last commit (Remove gethashespersec() from rpcmining) is completely optional and can be moved to another PR. |
|
Concept ACK and code looks good. We may want to deprecation period for gethashespersec() though, and just having it return 0 is not really acceptable. Having it return an error would be fine to me as nobody should really be depending on it anymore. |
|
utACK. I dont think we need a deprecation period for anything related to the internal miner. |
|
Waiting to get more consensus before changing the rpc stuff (in case we decide to leave it as it is now). |
|
So counting opinions on the RPC stuff... A) Just remove gethashespersec RPC call in this PR ( TheBlueMatt, jtimon ) total 2 I don't really have a strong opinion on this. I'm not in a hurry to remove the RPC call. |
|
I think gethashespersec is more or less worthless. I don't think I've heard of anyone using it in a long time. (IIRC it was even broken for a while). I don't really have a strong opinion, but I think this is an unimportant enough RPC that removing it shoudl be fine. @jgarzik has had opinions about the internal miner before. @luke-jr often has mining opinions |
|
Remove it |
|
As said before, sometimes I wonder why we don't just nuke the internal miner, instead of death by a thousand cuts. Anyhow - yes I'm fine with removing |
|
ut ACK |
|
Pushed one additional commit to avoid using boost on ScanHash(). |
|
utACK |
|
Needed rebase |
|
Closing in favor of #5957, although waiting for some nits to be solved. |
src/miner.cpp
Outdated
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.
This log could be removed too for additional regtest performance.
a663c23 to
260f19c
Compare
|
Rebased and reopened. |
329d930 to
4ff179d
Compare
|
Needed rebase |
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.
What is this "1000" magic value based on?
|
Most of the comments in this PR do not seem to apply to the actual code change here anymore. What is the motivation for this change? |
|
@laanwj instead of checking for the overflow of the nNonce, the magic 1000 is used. This does not check all possible values of the nonce before changing the extra nonce, but that shouldn't be a problem. The PR has many comments about the removal of the hashmeter, which was originally part of this, but was already merged separately. |
|
ping |
…nst CBlockHeader*, uint32_t&, uint256*) and use it in regtest Also, stop using multiple threads for mining in with regtest
|
Needed rebase. Also, I stopped using multiple threads for mining with regtest. |
|
Closing this old PR. This was a very confusing PR as @laanwj notes, as the associated commits keep changing, garnering ACKs, getting closed, getting re-opened. Please open a new PR with a specific focused change, and a fresh PR summary description. |
Continues #4506.
Following @laanwj 's advice of only moving ScanHash, I found another solution to encapsulate the miner's pow without removing the miner's optimization, which was rejected in #4423
But I would like to slightly change the behavior.
Commit "Replace proof.nNonce >= 0xffff000 with an iteration counter" should be either rejected or squashed into "proof.nNonce >= 0xffff0000 -> proof.OutOfRangeSolution()" (and of course that 1000 in the for is open for bike-shedding).
"Small miner optimization" also should be rejected or rebased in "Remove testnet's special case from miner.cpp".
I think these 2 functional changes are meaningless enough that can be safely accepted.
I would also be happy to just remove the hashmeter and the resulting PR would be simpler.