122@@ -124,14 +123,17 @@ static UniValue generateBlocks(const CScript& coinbase_script, int nGenerate, ui
123 LOCK(cs_main);
124 IncrementExtraNonce(pblock, ::ChainActive().Tip(), nExtraNonce);
125 }
126- while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus())) {
127+ while (nMaxTries > 0 && pblock->nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus()) && !ShutdownRequested()) {
128 ++pblock->nNonce;
129 --nMaxTries;
130 }
131+ if(ShutdownRequested()) {