mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
refactor: Remove call to ShutdownRequested from rpc/mining
Use chainman.m_interrupt object instead There is no change in behavior in this commit
This commit is contained in:
parent
263b23f008
commit
f0c73c1336
1 changed files with 3 additions and 4 deletions
|
@ -27,7 +27,6 @@
|
|||
#include <script/descriptor.h>
|
||||
#include <script/script.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <shutdown.h>
|
||||
#include <timedata.h>
|
||||
#include <txmempool.h>
|
||||
#include <univalue.h>
|
||||
|
@ -129,11 +128,11 @@ static bool GenerateBlock(ChainstateManager& chainman, CBlock& block, uint64_t&
|
|||
block_out.reset();
|
||||
block.hashMerkleRoot = BlockMerkleRoot(block);
|
||||
|
||||
while (max_tries > 0 && block.nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(block.GetHash(), block.nBits, chainman.GetConsensus()) && !ShutdownRequested()) {
|
||||
while (max_tries > 0 && block.nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(block.GetHash(), block.nBits, chainman.GetConsensus()) && !chainman.m_interrupt) {
|
||||
++block.nNonce;
|
||||
--max_tries;
|
||||
}
|
||||
if (max_tries == 0 || ShutdownRequested()) {
|
||||
if (max_tries == 0 || chainman.m_interrupt) {
|
||||
return false;
|
||||
}
|
||||
if (block.nNonce == std::numeric_limits<uint32_t>::max()) {
|
||||
|
@ -154,7 +153,7 @@ static bool GenerateBlock(ChainstateManager& chainman, CBlock& block, uint64_t&
|
|||
static UniValue generateBlocks(ChainstateManager& chainman, const CTxMemPool& mempool, const CScript& coinbase_script, int nGenerate, uint64_t nMaxTries)
|
||||
{
|
||||
UniValue blockHashes(UniValue::VARR);
|
||||
while (nGenerate > 0 && !ShutdownRequested()) {
|
||||
while (nGenerate > 0 && !chainman.m_interrupt) {
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler{chainman.ActiveChainstate(), &mempool}.CreateNewBlock(coinbase_script));
|
||||
if (!pblocktemplate.get())
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
|
||||
|
|
Loading…
Add table
Reference in a new issue