mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Add MineBlocksOnDemand chain parameter
This commit is contained in:
parent
1712adbe0b
commit
bfa9a1a638
@ -247,6 +247,7 @@ public:
|
|||||||
|
|
||||||
virtual bool RequireRPCPassword() const { return false; }
|
virtual bool RequireRPCPassword() const { return false; }
|
||||||
virtual bool MiningRequiresPeers() const { return false; }
|
virtual bool MiningRequiresPeers() const { return false; }
|
||||||
|
virtual bool MineBlocksOnDemand() const { return true; }
|
||||||
virtual Network NetworkID() const { return CChainParams::REGTEST; }
|
virtual Network NetworkID() const { return CChainParams::REGTEST; }
|
||||||
};
|
};
|
||||||
static CRegTestParams regTestParams;
|
static CRegTestParams regTestParams;
|
||||||
|
@ -62,6 +62,9 @@ public:
|
|||||||
/* Make miner wait to have peers to avoid wasting work */
|
/* Make miner wait to have peers to avoid wasting work */
|
||||||
virtual bool MiningRequiresPeers() const { return true; }
|
virtual bool MiningRequiresPeers() const { return true; }
|
||||||
const string& DataDir() const { return strDataDir; }
|
const string& DataDir() const { return strDataDir; }
|
||||||
|
/* Make miner stop after a block is found. In RPC, don't return
|
||||||
|
* until nGenProcLimit blocks are generated */
|
||||||
|
virtual bool MineBlocksOnDemand() const { return false; }
|
||||||
virtual Network NetworkID() const = 0;
|
virtual Network NetworkID() const = 0;
|
||||||
const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
|
const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
|
||||||
const std::vector<unsigned char> &Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
|
const std::vector<unsigned char> &Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
|
||||||
|
@ -580,9 +580,8 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
CheckWork(pblock, *pwallet, reservekey);
|
CheckWork(pblock, *pwallet, reservekey);
|
||||||
SetThreadPriority(THREAD_PRIORITY_LOWEST);
|
SetThreadPriority(THREAD_PRIORITY_LOWEST);
|
||||||
|
|
||||||
// In regression test mode, stop mining after a block is found. This
|
// In regression test mode, stop mining after a block is found.
|
||||||
// allows developers to controllably generate a block on demand.
|
if (Params().MineBlocksOnDemand())
|
||||||
if (Params().NetworkID() == CChainParams::REGTEST)
|
|
||||||
throw boost::thread_interrupted();
|
throw boost::thread_interrupted();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -174,7 +174,7 @@ Value setgenerate(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -regtest mode: don't return until nGenProcLimit blocks are generated
|
// -regtest mode: don't return until nGenProcLimit blocks are generated
|
||||||
if (fGenerate && Params().NetworkID() == CChainParams::REGTEST)
|
if (fGenerate && Params().MineBlocksOnDemand())
|
||||||
{
|
{
|
||||||
int nHeightStart = 0;
|
int nHeightStart = 0;
|
||||||
int nHeightEnd = 0;
|
int nHeightEnd = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user