Allow to override llmqChainLocks with "-llmqchainlocks" on devnet (#2683)

This commit is contained in:
Alexander Block 2019-02-05 15:46:05 +01:00 committed by GitHub
parent bed57cfbf6
commit 7e4257254c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View File

@ -667,6 +667,10 @@ public:
consensus.nHighSubsidyBlocks = nHighSubsidyBlocks;
consensus.nHighSubsidyFactor = nHighSubsidyFactor;
}
void UpdateLLMQChainLocks(Consensus::LLMQType llmqType) {
consensus.llmqChainLocks = llmqType;
}
};
static CDevNetParams *devNetParams;
@ -873,3 +877,9 @@ void UpdateDevnetSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSub
assert(devNetParams);
devNetParams->UpdateSubsidyAndDiffParams(nMinimumDifficultyBlocks, nHighSubsidyBlocks, nHighSubsidyFactor);
}
void UpdateDevnetLLMQChainLocks(Consensus::LLMQType llmqType)
{
assert(devNetParams);
devNetParams->UpdateLLMQChainLocks(llmqType);
}

View File

@ -162,4 +162,9 @@ void UpdateRegtestBudgetParameters(int nMasternodePaymentsStartBlock, int nBudge
*/
void UpdateDevnetSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor);
/**
* Allows modifying the LLMQ type for ChainLocks.
*/
void UpdateDevnetLLMQChainLocks(Consensus::LLMQType llmqType);
#endif // BITCOIN_CHAINPARAMS_H

View File

@ -1368,6 +1368,23 @@ bool AppInitParameterInteraction()
return InitError("Difficulty and subsidy parameters may only be overridden on devnet.");
}
if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) {
std::string llmqChainLocks = GetArg("-llmqchainlocks", Params().GetConsensus().llmqs.at(Params().GetConsensus().llmqChainLocks).name);
Consensus::LLMQType llmqType = Consensus::LLMQ_NONE;
for (const auto& p : Params().GetConsensus().llmqs) {
if (p.second.name == llmqChainLocks) {
llmqType = p.first;
break;
}
}
if (llmqType == Consensus::LLMQ_NONE) {
return InitError("Invalid LLMQ type specified for -llmqchainlocks.");
}
UpdateDevnetLLMQChainLocks(llmqType);
} else if (IsArgSet("-llmqchainlocks")) {
return InitError("LLMQ type for ChainLocks can only be overridden on devnet.");
}
return true;
}