Skip to content

Commit

Permalink
feat: new -llmqmnhf param for devnet (#5634)
Browse files Browse the repository at this point in the history
## Issue being fixed or feature implemented
By default consensus for devnet if 50_60 that is way too much:
```
        consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_50_60;
```
So, `quorum list` on devnet-ouzo is empty:
```
{
  "llmq_50_60": [
  ],
```

## What was done?
Adds new -llmqmnhf param for devnet to change quorum params dynamically.

## How Has This Been Tested?
<not tested>

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
  • Loading branch information
knst authored Oct 20, 2023
1 parent 5d8ffe5 commit 9a60987
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
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

0 comments on commit 9a60987

Please sign in to comment.