mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Add configurable devnet quorums (#3348)
* add new quorum type LLMQ_EVONET * add params for new quorum type LLMQ_EVONET * add LLMQ_EVONET to devnet llmqs * allow modifying of LLMQ_EVONET params on startup * rename LLMQ_EVONET to LLMQ_DEVNET * Update src/chainparams.cpp Co-Authored-By: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> * Update src/chainparams.cpp Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
8b7b4be804
commit
2521970a50
@ -124,6 +124,14 @@ void CChainParams::UpdateLLMQTestParams(int size, int threshold) {
|
||||
params.threshold = threshold;
|
||||
}
|
||||
|
||||
void CChainParams::UpdateLLMQDevnetParams(int size, int threshold)
|
||||
{
|
||||
auto& params = consensus.llmqs.at(Consensus::LLMQ_DEVNET);
|
||||
params.size = size;
|
||||
params.minSize = threshold;
|
||||
params.threshold = threshold;
|
||||
}
|
||||
|
||||
static CBlock FindDevNetGenesisBlock(const Consensus::Params& params, const CBlock &prevBlock, const CAmount& reward)
|
||||
{
|
||||
std::string devNetName = GetDevNetName();
|
||||
@ -167,6 +175,25 @@ static Consensus::LLMQParams llmq_test = {
|
||||
.keepOldConnections = 3,
|
||||
};
|
||||
|
||||
// this one is for devnets only
|
||||
static Consensus::LLMQParams llmq_devnet = {
|
||||
.type = Consensus::LLMQ_DEVNET,
|
||||
.name = "llmq_devnet",
|
||||
.size = 10,
|
||||
.minSize = 7,
|
||||
.threshold = 6,
|
||||
|
||||
.dkgInterval = 24, // one DKG per hour
|
||||
.dkgPhaseBlocks = 2,
|
||||
.dkgMiningWindowStart = 10, // dkgPhaseBlocks * 5 = after finalization
|
||||
.dkgMiningWindowEnd = 18,
|
||||
.dkgBadVotesThreshold = 7,
|
||||
|
||||
.signingActiveQuorumCount = 3, // just a few ones to allow easier testing
|
||||
|
||||
.keepOldConnections = 4,
|
||||
};
|
||||
|
||||
static Consensus::LLMQParams llmq50_60 = {
|
||||
.type = Consensus::LLMQ_50_60,
|
||||
.name = "llmq_50_60",
|
||||
@ -688,6 +715,7 @@ public:
|
||||
nExtCoinType = 1;
|
||||
|
||||
// long living quorum params
|
||||
consensus.llmqs[Consensus::LLMQ_DEVNET] = llmq_devnet;
|
||||
consensus.llmqs[Consensus::LLMQ_50_60] = llmq50_60;
|
||||
consensus.llmqs[Consensus::LLMQ_400_60] = llmq400_60;
|
||||
consensus.llmqs[Consensus::LLMQ_400_85] = llmq400_85;
|
||||
@ -909,3 +937,8 @@ void UpdateLLMQTestParams(int size, int threshold)
|
||||
{
|
||||
globalChainParams->UpdateLLMQTestParams(size, threshold);
|
||||
}
|
||||
|
||||
void UpdateLLMQDevnetParams(int size, int threshold)
|
||||
{
|
||||
globalChainParams->UpdateLLMQDevnetParams(size, threshold);
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
void UpdateSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor);
|
||||
void UpdateLLMQChainLocks(Consensus::LLMQType llmqType);
|
||||
void UpdateLLMQTestParams(int size, int threshold);
|
||||
void UpdateLLMQDevnetParams(int size, int threshold);
|
||||
int PoolMinParticipants() const { return nPoolMinParticipants; }
|
||||
int PoolMaxParticipants() const { return nPoolMaxParticipants; }
|
||||
int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; }
|
||||
@ -170,4 +171,9 @@ void UpdateDevnetLLMQChainLocks(Consensus::LLMQType llmqType);
|
||||
*/
|
||||
void UpdateLLMQTestParams(int size, int threshold);
|
||||
|
||||
/**
|
||||
* Allows modifying parameters of the devnet LLMQ
|
||||
*/
|
||||
void UpdateLLMQDevnetParams(int size, int threshold);
|
||||
|
||||
#endif // BITCOIN_CHAINPARAMS_H
|
||||
|
@ -50,6 +50,9 @@ enum LLMQType : uint8_t
|
||||
|
||||
// for testing only
|
||||
LLMQ_TEST = 100, // 3 members, 2 (66%) threshold, one per hour. Params might differ when -llmqtestparams is used
|
||||
|
||||
// for devnets only
|
||||
LLMQ_DEVNET = 101, // 10 members, 6 (60%) threshold, one per hour. Params might differ when -llmqdevnetparams is used
|
||||
};
|
||||
|
||||
// Configures a LLMQ and its DKG
|
||||
|
15
src/init.cpp
15
src/init.cpp
@ -1425,6 +1425,21 @@ bool AppInitParameterInteraction()
|
||||
return InitError("LLMQ type for ChainLocks can only be overridden on devnet.");
|
||||
}
|
||||
|
||||
if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) {
|
||||
if (gArgs.IsArgSet("-llmqdevnetparams")) {
|
||||
std::string s = gArgs.GetArg("-llmqdevnetparams", "");
|
||||
std::vector<std::string> v;
|
||||
boost::split(v, s, boost::is_any_of(":"));
|
||||
int size, threshold;
|
||||
if (v.size() != 2 || !ParseInt32(v[0], &size) || !ParseInt32(v[1], &threshold)) {
|
||||
return InitError("Invalid -llmqdevnetparams specified");
|
||||
}
|
||||
UpdateLLMQDevnetParams(size, threshold);
|
||||
}
|
||||
} else if (gArgs.IsArgSet("-llmqdevnetparams")) {
|
||||
return InitError("LLMQ devnet params can only be overridden on devnet.");
|
||||
}
|
||||
|
||||
if (chainparams.NetworkIDString() == CBaseChainParams::REGTEST) {
|
||||
if (gArgs.IsArgSet("-llmqtestparams")) {
|
||||
std::string s = gArgs.GetArg("-llmqtestparams", "");
|
||||
|
Loading…
Reference in New Issue
Block a user