Where is the nonce incremented in Bitcoin source code? I found where the extra nonce is incremented, but not the regular nonce?

| improve this question | | | | |

Line 132 in src/mining.cpp in the generateBlocks method.

while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus())) {

Update: Given @MeshCollider's answer I guess this is now only relevant on the regtest network.

| improve this answer | | | | |
  • Oh yes, there is still a miner for regtest, forgot about that :) – MeshCollider Nov 11 '17 at 6:37

The internal miner was removed from Bitcoin Core in version 0.13.0, in this PR: https://github.com/bitcoin/bitcoin/pull/7507

It used to be incremented in ScanHash(), but as of the removal, there is nowhere which increments the nonce, that would be done by mining software.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.