Skip to content

Conversation

@jtimon
Copy link
Contributor

@jtimon jtimon commented Aug 30, 2014

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.

@jtimon jtimon mentioned this pull request Aug 30, 2014
@jtimon jtimon force-pushed the proof2 branch 2 times, most recently from 69edb4f to c4c4b5a Compare September 1, 2014 00:57
@jtimon
Copy link
Contributor Author

jtimon commented Sep 1, 2014

Closing as it is included in #4794 with only one commit more.

@jtimon jtimon closed this Sep 1, 2014
@jtimon jtimon deleted the proof2 branch September 1, 2014 19:20
@jtimon jtimon changed the title Encapsulate miner-related pow in Proof class Encapsulate miner-related pow in ScanHash Sep 2, 2014
@jtimon jtimon restored the proof2 branch September 2, 2014 11:07
@jtimon
Copy link
Contributor Author

jtimon commented Sep 2, 2014

Reopened as independent from #4506

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4793_cf07ea708c5822687ea9ef9c70a37324843a43b4/ for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

src/miner.cpp Outdated
Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@jtimon
Copy link
Contributor Author

jtimon commented Oct 10, 2014

@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.

@jtimon jtimon force-pushed the proof2 branch 2 times, most recently from 72dd03d to 0810550 Compare October 10, 2014 20:33
@jtimon
Copy link
Contributor Author

jtimon commented Oct 10, 2014

The last commit (Remove gethashespersec() from rpcmining) is completely optional and can be moved to another PR.

@sipa
Copy link
Member

sipa commented Oct 10, 2014

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.

@TheBlueMatt
Copy link
Contributor

utACK. I dont think we need a deprecation period for anything related to the internal miner.

@jtimon
Copy link
Contributor Author

jtimon commented Oct 11, 2014

Waiting to get more consensus before changing the rpc stuff (in case we decide to leave it as it is now).
I prefer to just remove it but I have no strong opinion on this.

@jtimon
Copy link
Contributor Author

jtimon commented Oct 14, 2014

So counting opinions on the RPC stuff...

A) Just remove gethashespersec RPC call in this PR ( TheBlueMatt, jtimon ) total 2
B) Leave gethashespersec but throw an error when somebody calls it (sipa) total 1
C) Let gethashespersec return always 0 and leave the RPC for another PR (nobody) total 0

I don't really have a strong opinion on this. I'm not in a hurry to remove the RPC call.
Please, more opinions are greatly appreciated.

@gmaxwell
Copy link
Contributor

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

@Diapolo
Copy link

Diapolo commented Oct 14, 2014

Remove it gethashespersec, as long as the internal miner is working I'm fine with that ;).

@laanwj
Copy link
Member

laanwj commented Oct 14, 2014

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 gethashespersec.

@sipa
Copy link
Member

sipa commented Oct 14, 2014

ut ACK

@jtimon
Copy link
Contributor Author

jtimon commented Oct 22, 2014

Pushed one additional commit to avoid using boost on ScanHash().
Instead it returns false, and just after that boost::this_thread::interruption_point() was called anyway.

@maaku
Copy link
Contributor

maaku commented Oct 28, 2014

utACK

@jtimon
Copy link
Contributor Author

jtimon commented Mar 26, 2015

Needed rebase

@jtimon jtimon changed the title Pow: Refactor: Encapsulate miner-related pow in GenerateProof (was ScanHash) amd use it for regtest mining Pow: Refactor: Encapsulate miner-related pow in GenerateProof (was ScanHash) and use it for regtest mining Apr 6, 2015
@sipa
Copy link
Member

sipa commented Apr 7, 2015

@jtimon #5957 includes something similar to this (but goes further). I forgot you had a PR still open for this.

@jtimon
Copy link
Contributor Author

jtimon commented Apr 8, 2015

Closing in favor of #5957, although waiting for some nits to be solved.
I plan to remove the CheckProofOfWork() warnings as part of the libconsensus work to expose VerifyBlockHeader() soon.

src/miner.cpp Outdated
Copy link
Contributor Author

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.

@jtimon jtimon force-pushed the proof2 branch 2 times, most recently from a663c23 to 260f19c Compare April 10, 2015 09:45
@jtimon
Copy link
Contributor Author

jtimon commented Apr 10, 2015

Rebased and reopened.

@jtimon
Copy link
Contributor Author

jtimon commented Apr 20, 2015

Needed rebase

Copy link
Member

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?

@laanwj
Copy link
Member

laanwj commented May 6, 2015

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?

@jtimon
Copy link
Contributor Author

jtimon commented May 6, 2015

@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.
It can be make a constant, sure. I was hoping that @sipa @luke-jr or someone less lazy than me for base conversions and hexadecimal would say something like "since ScanHash returns false when pblock->nNonce & 0xfff) == 0 you can safely change the 1000 for X and we will still exhaust all the possibilities with the 32 bits of the nonce"..
We should probably make that 0xfff a constant as well. Any suggestions for the constants are welcomed.

The PR has many comments about the removal of the hashmeter, which was originally part of this, but was already merged separately.
This was part of the effort to encapsulate the proof of work and it reduces the number of places in mining where nBits and nNonce are used.
It should also make regtest slightly faster, but I haven't tested that. It also makes regtest and non-regtest mining more similar.

@jtimon
Copy link
Contributor Author

jtimon commented Jun 25, 2015

ping

…nst CBlockHeader*, uint32_t&, uint256*) and use it in regtest

Also, stop using multiple threads for mining in with regtest
@jtimon
Copy link
Contributor Author

jtimon commented Jul 4, 2015

Needed rebase. Also, I stopped using multiple threads for mining with regtest.

@jgarzik
Copy link
Contributor

jgarzik commented Jul 23, 2015

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.

@jgarzik jgarzik closed this Jul 23, 2015
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants