|
12 | 12 | #include <tinyformat.h>
|
13 | 13 | #include <util/ranges.h>
|
14 | 14 | #include <util/system.h>
|
| 15 | +#include <util/underlying.h> |
15 | 16 | #include <versionbitsinfo.h>
|
16 | 17 |
|
17 | 18 | #include <arith_uint256.h>
|
@@ -1045,6 +1046,8 @@ class CRegTestParams : public CChainParams {
|
1045 | 1046 |
|
1046 | 1047 | UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST);
|
1047 | 1048 | UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_INSTANTSEND);
|
| 1049 | + UpdateLLMQInstantSendFromArgs(args); |
| 1050 | + UpdateLLMQInstantSendDIP0024FromArgs(args); |
1048 | 1051 | }
|
1049 | 1052 |
|
1050 | 1053 | /**
|
@@ -1111,7 +1114,26 @@ class CRegTestParams : public CChainParams {
|
1111 | 1114 | params->threshold = threshold;
|
1112 | 1115 | params->dkgBadVotesThreshold = threshold;
|
1113 | 1116 | }
|
| 1117 | + |
| 1118 | + /** |
| 1119 | + * Allows modifying the LLMQ type for InstantSend. |
| 1120 | + */ |
| 1121 | + void UpdateLLMQInstantSend(Consensus::LLMQType llmqType) |
| 1122 | + { |
| 1123 | + consensus.llmqTypeInstantSend = llmqType; |
| 1124 | + } |
| 1125 | + |
| 1126 | + /** |
| 1127 | + * Allows modifying the LLMQ type for InstantSend (DIP0024). |
| 1128 | + */ |
| 1129 | + void UpdateLLMQDIP0024InstantSend(Consensus::LLMQType llmqType) |
| 1130 | + { |
| 1131 | + consensus.llmqTypeDIP0024InstantSend = llmqType; |
| 1132 | + } |
| 1133 | + |
1114 | 1134 | void UpdateLLMQTestParametersFromArgs(const ArgsManager& args, const Consensus::LLMQType llmqType);
|
| 1135 | + void UpdateLLMQInstantSendFromArgs(const ArgsManager& args); |
| 1136 | + void UpdateLLMQInstantSendDIP0024FromArgs(const ArgsManager& args); |
1115 | 1137 | };
|
1116 | 1138 |
|
1117 | 1139 | void CRegTestParams::UpdateVersionBitsParametersFromArgs(const ArgsManager& args)
|
@@ -1253,6 +1275,50 @@ void CRegTestParams::UpdateLLMQTestParametersFromArgs(const ArgsManager& args, c
|
1253 | 1275 | UpdateLLMQTestParameters(size, threshold, llmqType);
|
1254 | 1276 | }
|
1255 | 1277 |
|
| 1278 | +void CRegTestParams::UpdateLLMQInstantSendFromArgs(const ArgsManager& args) |
| 1279 | +{ |
| 1280 | + if (!args.IsArgSet("-llmqinstantsend")) return; |
| 1281 | + |
| 1282 | + const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeInstantSend); |
| 1283 | + assert(llmq_params_opt.has_value()); |
| 1284 | + |
| 1285 | + std::string strLLMQType = gArgs.GetArg("-llmqinstantsend", std::string(llmq_params_opt->name)); |
| 1286 | + |
| 1287 | + Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE; |
| 1288 | + for (const auto& params : consensus.llmqs) { |
| 1289 | + if (params.name == strLLMQType) { |
| 1290 | + llmqType = params.type; |
| 1291 | + } |
| 1292 | + } |
| 1293 | + if (llmqType == Consensus::LLMQType::LLMQ_NONE) { |
| 1294 | + throw std::runtime_error("Invalid LLMQ type specified for -llmqinstantsend."); |
| 1295 | + } |
| 1296 | + LogPrintf("Setting llmqinstantsend to size=%ld\n", ToUnderlying(llmqType)); |
| 1297 | + UpdateLLMQInstantSend(llmqType); |
| 1298 | +} |
| 1299 | + |
| 1300 | +void CRegTestParams::UpdateLLMQInstantSendDIP0024FromArgs(const ArgsManager& args) |
| 1301 | +{ |
| 1302 | + if (!args.IsArgSet("-llmqinstantsenddip0024")) return; |
| 1303 | + |
| 1304 | + const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeDIP0024InstantSend); |
| 1305 | + assert(llmq_params_opt.has_value()); |
| 1306 | + |
| 1307 | + std::string strLLMQType = gArgs.GetArg("-llmqinstantsenddip0024", std::string(llmq_params_opt->name)); |
| 1308 | + |
| 1309 | + Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE; |
| 1310 | + for (const auto& params : consensus.llmqs) { |
| 1311 | + if (params.name == strLLMQType) { |
| 1312 | + llmqType = params.type; |
| 1313 | + } |
| 1314 | + } |
| 1315 | + if (llmqType == Consensus::LLMQType::LLMQ_NONE) { |
| 1316 | + throw std::runtime_error("Invalid LLMQ type specified for -llmqinstantsenddip0024."); |
| 1317 | + } |
| 1318 | + LogPrintf("Setting llmqinstantsenddip0024 to size=%ld\n", ToUnderlying(llmqType)); |
| 1319 | + UpdateLLMQDIP0024InstantSend(llmqType); |
| 1320 | +} |
| 1321 | + |
1256 | 1322 | void CDevNetParams::UpdateDevnetSubsidyAndDiffParametersFromArgs(const ArgsManager& args)
|
1257 | 1323 | {
|
1258 | 1324 | if (!args.IsArgSet("-minimumdifficultyblocks") && !args.IsArgSet("-highsubsidyblocks") && !args.IsArgSet("-highsubsidyfactor")) return;
|
|
0 commit comments