[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);

Ok I realize I misread the precedence when I originally suggested to put it in the while condition. Sorry about that. Now I think it’d be better to put it in the block and let the assert do its thing. :P

Добавить комментарий