mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-08 22:55:16 +01:00
Allow setting nMinimumChainWork on command line
This commit is contained in:
committed by
Suhas Daftuar
parent
e0e3cbbf08
commit
0311836f69
17
src/init.cpp
17
src/init.cpp
@@ -354,6 +354,9 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-maxorphantx=<n>", strprintf(_("Keep at most <n> unconnectable transactions in memory (default: %u)"), DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||
strUsage += HelpMessageOpt("-maxmempool=<n>", strprintf(_("Keep the transaction memory pool below <n> megabytes (default: %u)"), DEFAULT_MAX_MEMPOOL_SIZE));
|
||||
strUsage += HelpMessageOpt("-mempoolexpiry=<n>", strprintf(_("Do not keep transactions in the mempool longer than <n> hours (default: %u)"), DEFAULT_MEMPOOL_EXPIRY));
|
||||
if (showDebug) {
|
||||
strUsage += HelpMessageOpt("-minimumchainwork=<hex>", strprintf("Minimum work assumed to exist on a valid chain in hex (default: %s, testnet: %s)", defaultChainParams->GetConsensus().nMinimumChainWork.GetHex(), testnetChainParams->GetConsensus().nMinimumChainWork.GetHex()));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-persistmempool", strprintf(_("Whether to save the mempool on shutdown and load on restart (default: %u)"), DEFAULT_PERSIST_MEMPOOL));
|
||||
strUsage += HelpMessageOpt("-blockreconstructionextratxn=<n>", strprintf(_("Extra transactions to keep in memory for compact block reconstructions (default: %u)"), DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN));
|
||||
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
|
||||
@@ -970,6 +973,20 @@ bool AppInitParameterInteraction()
|
||||
else
|
||||
LogPrintf("Validating signatures for all blocks.\n");
|
||||
|
||||
if (gArgs.IsArgSet("-minimumchainwork")) {
|
||||
const std::string minChainWorkStr = gArgs.GetArg("-minimumchainwork", "");
|
||||
if (!IsHexNumber(minChainWorkStr)) {
|
||||
return InitError(strprintf("Invalid non-hex (%s) minimum chain work value specified", minChainWorkStr));
|
||||
}
|
||||
nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr));
|
||||
} else {
|
||||
nMinimumChainWork = UintToArith256(chainparams.GetConsensus().nMinimumChainWork);
|
||||
}
|
||||
LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex());
|
||||
if (nMinimumChainWork < UintToArith256(chainparams.GetConsensus().nMinimumChainWork)) {
|
||||
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainparams.GetConsensus().nMinimumChainWork.GetHex());
|
||||
}
|
||||
|
||||
// mempool limits
|
||||
int64_t nMempoolSizeMax = gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
|
||||
int64_t nMempoolSizeMin = gArgs.GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
|
||||
|
||||
Reference in New Issue
Block a user