Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new -llmqmnhf param for devnet #5634

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ class CDevNetParams : public CChainParams {
UpdateDevnetLLMQInstantSendFromArgs(args);
UpdateDevnetLLMQInstantSendDIP0024FromArgs(args);
UpdateDevnetLLMQPlatformFromArgs(args);
UpdateDevnetLLMQMnhfFromArgs(args);
UpdateLLMQDevnetParametersFromArgs(args);
UpdateDevnetPowTargetSpacingFromArgs(args);

Expand Down Expand Up @@ -737,6 +738,14 @@ class CDevNetParams : public CChainParams {
consensus.llmqTypeAssetLocks = llmqType;
}

/**
* Allows modifying the LLMQ type for Mnhf.
*/
void UpdateDevnetLLMQMnhf(Consensus::LLMQType llmqType)
{
consensus.llmqTypeMnhf = llmqType;
}

/**
* Allows modifying PowTargetSpacing
*/
Expand All @@ -761,6 +770,7 @@ class CDevNetParams : public CChainParams {
void UpdateDevnetLLMQInstantSendFromArgs(const ArgsManager& args);
void UpdateDevnetLLMQInstantSendDIP0024FromArgs(const ArgsManager& args);
void UpdateDevnetLLMQPlatformFromArgs(const ArgsManager& args);
void UpdateDevnetLLMQMnhfFromArgs(const ArgsManager& args);
void UpdateDevnetPowTargetSpacingFromArgs(const ArgsManager& args);
};

Expand Down Expand Up @@ -1321,6 +1331,28 @@ void CDevNetParams::UpdateDevnetLLMQPlatformFromArgs(const ArgsManager& args)
UpdateDevnetLLMQPlatform(llmqType);
}

void CDevNetParams::UpdateDevnetLLMQMnhfFromArgs(const ArgsManager& args)
{
if (!args.IsArgSet("-llmqmnhf")) return;

const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeMnhf);
assert(llmq_params_opt.has_value());

std::string strLLMQType = gArgs.GetArg("-llmqmnhf", std::string(llmq_params_opt->name));

Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
for (const auto& params : consensus.llmqs) {
if (params.name == strLLMQType) {
llmqType = params.type;
}
}
if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
throw std::runtime_error("Invalid LLMQ type specified for -llmqmnhf.");
}
LogPrintf("Setting llmqmnhf to size=%ld\n", static_cast<uint8_t>(llmqType));
UpdateDevnetLLMQMnhf(llmqType);
}

void CDevNetParams::UpdateDevnetPowTargetSpacingFromArgs(const ArgsManager& args)
{
if (!args.IsArgSet("-powtargetspacing")) return;
Expand Down
1 change: 1 addition & 0 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-llmqinstantsend=<quorum name>", "Override the default LLMQ type used for InstantSend. Allows using InstantSend with smaller LLMQs. (default: llmq_50_60, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqinstantsenddip0024=<quorum name>", "Override the default LLMQ type used for InstantSendDIP0024. (default: llmq_60_75, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqplatform=<quorum name>", "Override the default LLMQ type used for Platform. (default: llmq_100_67, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqmnhf=<quorum name>", "Override the default LLMQ type used for EHF. (default: llmq_50_60, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqtestparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST quorum (default: 3:2, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqtestinstantsendparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST_INSTANTSEND quorums (default: 3:2, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-powtargetspacing=<n>", "Override the default PowTargetSpacing value in seconds (default: 2.5 minutes, devnet-only)", ArgsManager::ALLOW_INT, OptionsCategory::CHAINPARAMS);
Expand Down
Loading