mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
Add DefaultMinerThreads chain parameter
This commit is contained in:
parent
bfa9a1a638
commit
2595b9ac23
3 changed files with 8 additions and 2 deletions
|
@ -112,6 +112,7 @@ public:
|
||||||
nRPCPort = 8332;
|
nRPCPort = 8332;
|
||||||
bnProofOfWorkLimit = ~uint256(0) >> 32;
|
bnProofOfWorkLimit = ~uint256(0) >> 32;
|
||||||
nSubsidyHalvingInterval = 210000;
|
nSubsidyHalvingInterval = 210000;
|
||||||
|
nMinerThreads = 0;
|
||||||
|
|
||||||
// Build the genesis block. Note that the output of the genesis coinbase cannot
|
// Build the genesis block. Note that the output of the genesis coinbase cannot
|
||||||
// be spent as it did not originally exist in the database.
|
// be spent as it did not originally exist in the database.
|
||||||
|
@ -233,6 +234,7 @@ public:
|
||||||
pchMessageStart[2] = 0xb5;
|
pchMessageStart[2] = 0xb5;
|
||||||
pchMessageStart[3] = 0xda;
|
pchMessageStart[3] = 0xda;
|
||||||
nSubsidyHalvingInterval = 150;
|
nSubsidyHalvingInterval = 150;
|
||||||
|
nMinerThreads = 1;
|
||||||
bnProofOfWorkLimit = ~uint256(0) >> 1;
|
bnProofOfWorkLimit = ~uint256(0) >> 1;
|
||||||
genesis.nTime = 1296688602;
|
genesis.nTime = 1296688602;
|
||||||
genesis.nBits = 0x207fffff;
|
genesis.nBits = 0x207fffff;
|
||||||
|
|
|
@ -57,6 +57,8 @@ public:
|
||||||
int GetDefaultPort() const { return nDefaultPort; }
|
int GetDefaultPort() const { return nDefaultPort; }
|
||||||
const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
|
const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
|
||||||
int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
|
int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
|
||||||
|
/* Used if GenerateBitcoins is called with a negative number of threads */
|
||||||
|
int DefaultMinerThreads() const { return nMinerThreads; }
|
||||||
virtual const CBlock& GenesisBlock() const = 0;
|
virtual const CBlock& GenesisBlock() const = 0;
|
||||||
virtual bool RequireRPCPassword() const { return true; }
|
virtual bool RequireRPCPassword() const { return true; }
|
||||||
/* Make miner wait to have peers to avoid wasting work */
|
/* Make miner wait to have peers to avoid wasting work */
|
||||||
|
@ -82,6 +84,7 @@ protected:
|
||||||
uint256 bnProofOfWorkLimit;
|
uint256 bnProofOfWorkLimit;
|
||||||
int nSubsidyHalvingInterval;
|
int nSubsidyHalvingInterval;
|
||||||
string strDataDir;
|
string strDataDir;
|
||||||
|
int nMinerThreads;
|
||||||
vector<CDNSSeedData> vSeeds;
|
vector<CDNSSeedData> vSeeds;
|
||||||
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
|
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
|
||||||
};
|
};
|
||||||
|
|
|
@ -652,8 +652,9 @@ void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads)
|
||||||
static boost::thread_group* minerThreads = NULL;
|
static boost::thread_group* minerThreads = NULL;
|
||||||
|
|
||||||
if (nThreads < 0) {
|
if (nThreads < 0) {
|
||||||
if (Params().NetworkID() == CChainParams::REGTEST)
|
// In regtest threads defaults to 1
|
||||||
nThreads = 1;
|
if (Params().DefaultMinerThreads())
|
||||||
|
nThreads = Params().DefaultMinerThreads();
|
||||||
else
|
else
|
||||||
nThreads = boost::thread::hardware_concurrency();
|
nThreads = boost::thread::hardware_concurrency();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue