As much as possible here, our goal is to: - Allow overriding anything that can be overridden in CCustomParams; - Leave everything alone unless an argument / config parameter was given. This is unlike the CCustomParams UpdateFromArgs method, which has lots of defaults in it.
| 1405 | // - Leave everything alone unless an argument / config parameter was given. |
| 1406 | // This is unlike the CCustomParams UpdateFromArgs method, which has lots of defaults in it. |
| 1407 | void UpdateFromArgs(const ArgsManager& args) |
| 1408 | { |
| 1409 | consensus.nSubsidyHalvingInterval = args.GetIntArg("-con_nsubsidyhalvinginterval", consensus.nSubsidyHalvingInterval); |
| 1410 | if (args.IsArgSet("-con_bip16exception")) { |
| 1411 | consensus.BIP16Exception = uint256S(args.GetArg("-con_bip16exception", "")); |
| 1412 | } |
| 1413 | consensus.BIP34Height = args.GetIntArg("-con_bip34height", consensus.BIP34Height); |
| 1414 | if (args.IsArgSet("-con_bip34hash")) { |
| 1415 | consensus.BIP34Hash = uint256S(args.GetArg("-con_bip34hash", "")); |
| 1416 | } |
| 1417 | consensus.BIP65Height = args.GetIntArg("-con_bip65height", consensus.BIP65Height); |
| 1418 | consensus.BIP66Height = args.GetIntArg("-con_bip66height", consensus.BIP66Height); |
| 1419 | if (args.IsArgSet("-con_powlimit")) { |
| 1420 | consensus.powLimit = uint256S(args.GetArg("-con_powlimit", "")); |
| 1421 | } |
| 1422 | consensus.nPowTargetTimespan = args.GetIntArg("-con_npowtargettimespan", consensus.nPowTargetTimespan); |
| 1423 | consensus.nPowTargetSpacing = args.GetIntArg("-con_npowtargetspacing", consensus.nPowTargetSpacing); |
| 1424 | consensus.fPowAllowMinDifficultyBlocks = args.GetBoolArg("-con_fpowallowmindifficultyblocks", consensus.fPowAllowMinDifficultyBlocks); |
| 1425 | consensus.fPowNoRetargeting = args.GetBoolArg("-con_fpownoretargeting", consensus.fPowNoRetargeting); |
| 1426 | consensus.nRuleChangeActivationThreshold = (uint32_t)args.GetIntArg("-con_nrulechangeactivationthreshold", consensus.nRuleChangeActivationThreshold); |
| 1427 | consensus.nMinerConfirmationWindow = (uint32_t)args.GetIntArg("-con_nminerconfirmationwindow", consensus.nMinerConfirmationWindow); |
| 1428 | |
| 1429 | if (args.IsArgSet("-con_nminimumchainwork")) { |
| 1430 | consensus.nMinimumChainWork = uint256S(args.GetArg("-con_nminimumchainwork", "")); |
| 1431 | } |
| 1432 | if (args.IsArgSet("-con_defaultassumevalid")) { |
| 1433 | consensus.defaultAssumeValid = uint256S(args.GetArg("-con_defaultassumevalid", "")); |
| 1434 | } |
| 1435 | // TODO: Embed in genesis block in nTime field with new genesis block type |
| 1436 | consensus.dynamic_epoch_length = args.GetIntArg("-dynamic_epoch_length", consensus.dynamic_epoch_length); |
| 1437 | |
| 1438 | std::vector<std::string> pak_list_str = args.GetArgs("-pak"); |
| 1439 | if (!pak_list_str.empty()) { |
| 1440 | consensus.first_extension_space.clear(); |
| 1441 | for (const auto& entry : pak_list_str) { |
| 1442 | consensus.first_extension_space.push_back(ParseHex(entry)); |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | nPruneAfterHeight = (uint64_t)args.GetIntArg("-npruneafterheight", nPruneAfterHeight); |
| 1447 | fDefaultConsistencyChecks = args.GetBoolArg("-fdefaultconsistencychecks", fDefaultConsistencyChecks); |
| 1448 | m_is_test_chain = args.GetBoolArg("-fmineblocksondemand", m_is_test_chain); |
| 1449 | |
| 1450 | bech32_hrp = args.GetArg("-bech32_hrp", bech32_hrp); |
| 1451 | blech32_hrp = args.GetArg("-blech32_hrp", blech32_hrp); |
| 1452 | |
| 1453 | if (args.IsArgSet("-pubkeyprefix")) { |
| 1454 | base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-pubkeyprefix", 0)); |
| 1455 | } |
| 1456 | if (args.IsArgSet("-scriptprefix")) { |
| 1457 | base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-scriptprefix", 0)); |
| 1458 | } |
| 1459 | if (args.IsArgSet("-blindedprefix")) { |
| 1460 | base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-blindedprefix", 0)); |
| 1461 | } |
| 1462 | if (args.IsArgSet("-secretprefix")) { |
| 1463 | base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, args.GetIntArg("-secretprefix", 0)); |
| 1464 | } |
nothing calls this directly
no test coverage detected