MCPcopy Create free account
hub / github.com/ElementsProject/elements / UpdateFromArgs

Method UpdateFromArgs

src/chainparams.cpp:803–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801 std::string default_signblockscript = "51";
802 bool use_invalid_seeds = true;
803 void UpdateFromArgs(const ArgsManager& args)
804 {
805 UpdateActivationParametersFromArgs(args);
806
807 consensus.nSubsidyHalvingInterval = args.GetIntArg("-con_nsubsidyhalvinginterval", consensus.nSubsidyHalvingInterval);
808 consensus.BIP16Exception = uint256S(args.GetArg("-con_bip16exception", "0x0"));
809 consensus.BIP34Height = args.GetIntArg("-con_bip34height", 0);
810 consensus.BIP34Hash = uint256S(args.GetArg("-con_bip34hash", "0x0"));
811 consensus.BIP65Height = args.GetIntArg("-con_bip65height", 0);
812 consensus.BIP66Height = args.GetIntArg("-con_bip66height", 0);
813 consensus.CSVHeight = args.GetIntArg("-con_csv_deploy_start", 1);
814 consensus.powLimit = uint256S(args.GetArg("-con_powlimit", "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
815 consensus.nPowTargetTimespan = args.GetIntArg("-con_npowtargettimespan", consensus.nPowTargetTimespan);
816 consensus.nPowTargetSpacing = args.GetIntArg("-con_npowtargetspacing", consensus.nPowTargetSpacing);
817 consensus.fPowAllowMinDifficultyBlocks = args.GetBoolArg("-con_fpowallowmindifficultyblocks", consensus.fPowAllowMinDifficultyBlocks);
818 consensus.fPowNoRetargeting = args.GetBoolArg("-con_fpownoretargeting", consensus.fPowNoRetargeting);
819 consensus.nRuleChangeActivationThreshold = (uint32_t)args.GetIntArg("-con_nrulechangeactivationthreshold", consensus.nRuleChangeActivationThreshold);
820 consensus.nMinerConfirmationWindow = (uint32_t)args.GetIntArg("-con_nminerconfirmationwindow", consensus.nMinerConfirmationWindow);
821
822 consensus.nMinimumChainWork = uint256S(args.GetArg("-con_nminimumchainwork", "0x0"));
823 consensus.defaultAssumeValid = uint256S(args.GetArg("-con_defaultassumevalid", "0x00"));
824 // TODO: Embed in genesis block in nTime field with new genesis block type
825 consensus.dynamic_epoch_length = args.GetIntArg("-dynamic_epoch_length", consensus.dynamic_epoch_length);
826 // Default junk keys for testing
827 consensus.first_extension_space = {ParseHex("02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f02fcba7ecf41bc7e1be4ee122d9d22e3333671eb0a3a87b5cdf099d59874e1940f")};
828 std::vector<std::string> pak_list_str = args.GetArgs("-pak");
829 if (!pak_list_str.empty()) {
830 consensus.first_extension_space.clear();
831 for (const auto& entry : pak_list_str) {
832 consensus.first_extension_space.push_back(ParseHex(entry));
833 }
834 }
835
836 nPruneAfterHeight = (uint64_t)args.GetIntArg("-npruneafterheight", nPruneAfterHeight);
837 fDefaultConsistencyChecks = args.GetBoolArg("-fdefaultconsistencychecks", fDefaultConsistencyChecks);
838 m_is_test_chain = args.GetBoolArg("-fmineblocksondemand", m_is_test_chain);
839
840 bech32_hrp = args.GetArg("-bech32_hrp", bech32_hrp);
841 blech32_hrp = args.GetArg("-blech32_hrp", blech32_hrp);
842 assert(base58Prefixes[PUBKEY_ADDRESS].size() == 1);
843 assert(base58Prefixes[SCRIPT_ADDRESS].size() == 1);
844 assert(base58Prefixes[BLINDED_ADDRESS].size() == 1);
845 assert(base58Prefixes[SECRET_KEY].size() == 1);
846 base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-pubkeyprefix", base58Prefixes[PUBKEY_ADDRESS][0]));
847 base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-scriptprefix", base58Prefixes[SCRIPT_ADDRESS][0]));
848 base58Prefixes[BLINDED_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-blindedprefix", base58Prefixes[BLINDED_ADDRESS][0]));
849 base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, args.GetIntArg("-secretprefix", base58Prefixes[SECRET_KEY][0]));
850 base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-parentpubkeyprefix", 111));
851 base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, args.GetIntArg("-parentscriptprefix", 196));
852 parent_bech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");
853 parent_blech32_hrp = args.GetArg("-parent_blech32_hrp", "bcrt");
854
855
856 std::string extpubprefix = args.GetArg("-extpubkeyprefix", "043587CF");
857 assert(IsHex(extpubprefix) && extpubprefix.size() == 8 && "-extpubkeyprefix must be hex string of length 8");
858 base58Prefixes[EXT_PUBLIC_KEY] = ParseHex(extpubprefix);
859
860 std::string extprvprefix = args.GetArg("-extprvkeyprefix", "04358394");

Callers

nothing calls this directly

Calls 15

uint256SFunction · 0.85
ParseHexFunction · 0.85
IsHexFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
CommitToArgumentsFunction · 0.85
GenerateAssetEntropyFunction · 0.85
CalculateAssetFunction · 0.85
CAssetClass · 0.85
GetIntArgMethod · 0.80

Tested by

no test coverage detected