Skip to content

Commit

Permalink
Allow to override llmqChainLocks with "-llmqchainlocks" on devnet (#2683
Browse files Browse the repository at this point in the history
)
  • Loading branch information
codablock committed Feb 5, 2019
1 parent bed57cf commit 7e42572
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,10 @@ class CDevNetParams : public CChainParams {
consensus.nHighSubsidyBlocks = nHighSubsidyBlocks;
consensus.nHighSubsidyFactor = nHighSubsidyFactor;
}

void UpdateLLMQChainLocks(Consensus::LLMQType llmqType) {
consensus.llmqChainLocks = llmqType;
}
};
static CDevNetParams *devNetParams;

Expand Down Expand Up @@ -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);
}
5 changes: 5 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7e42572

Please sign in to comment.