[bitcoin/bitcoin] Don’t assert(foo()) where foo() has side effects (#13534)

Empact commented on this pull request.

> @@ -40,8 +40,8 @@ static CTxIn MineBlock(const CScript& coinbase_scriptPubKey)
{
auto block = PrepareBlock(coinbase_scriptPubKey);

– while (!CheckProofOfWork(block->GetHash(), block->nBits, Params().GetConsensus())) {
– assert(++block->nNonce);
+ while (!CheckProofOfWork(block->GetHash(), block->nBits, Params().GetConsensus()) && ++block->nNonce) {
+ assert(block->nNonce);

This will never fail on account of `->nNonce` being in the `while` condition.

This post was last modified on July 6, 2018, 12:51 pm