LCOV - code coverage report
Current view: top level - src - chainparams.cpp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 842 970 86.8 %
Date: 2026-06-25 07:23:43 Functions: 38 46 82.6 %

          Line data    Source code
       1             : // Copyright (c) 2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2021 The Bitcoin Core developers
       3             : // Copyright (c) 2014-2025 The Dash Core developers
       4             : // Distributed under the MIT software license, see the accompanying
       5             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       6             : 
       7             : #include <chainparams.h>
       8             : 
       9             : #include <llmq/params.h>
      10             : #include <util/std23.h>
      11             : 
      12             : #include <arith_uint256.h>
      13             : #include <chainparamsseeds.h>
      14             : #include <consensus/merkle.h>
      15             : #include <deploymentinfo.h>
      16             : #include <util/system.h>
      17             : #include <versionbits.h>
      18             : 
      19             : #include <cassert>
      20             : #include <ranges>
      21             : 
      22       20004 : static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
      23             : {
      24       20004 :     CMutableTransaction txNew;
      25       20004 :     txNew.nVersion = 1;
      26       20004 :     txNew.vin.resize(1);
      27       20004 :     txNew.vout.resize(1);
      28       20004 :     txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
      29       20004 :     txNew.vout[0].nValue = genesisReward;
      30       20004 :     txNew.vout[0].scriptPubKey = genesisOutputScript;
      31             : 
      32       20004 :     CBlock genesis;
      33       20004 :     genesis.nTime    = nTime;
      34       20004 :     genesis.nBits    = nBits;
      35       20004 :     genesis.nNonce   = nNonce;
      36       20004 :     genesis.nVersion = nVersion;
      37       20004 :     genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
      38       20004 :     genesis.hashPrevBlock.SetNull();
      39       20004 :     genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
      40       20004 :     return genesis;
      41       20004 : }
      42             : 
      43        3796 : static CBlock CreateDevNetGenesisBlock(const uint256 &prevBlockHash, const std::string& devNetName, uint32_t nTime, uint32_t nNonce, uint32_t nBits, const CAmount& genesisReward)
      44             : {
      45        3796 :     assert(!devNetName.empty());
      46             : 
      47        3796 :     CMutableTransaction txNew;
      48        3796 :     txNew.nVersion = 1;
      49        3796 :     txNew.vin.resize(1);
      50        3796 :     txNew.vout.resize(1);
      51             :     // put height (BIP34) and devnet name into coinbase
      52        3796 :     txNew.vin[0].scriptSig = CScript() << 1 << std::vector<unsigned char>(devNetName.begin(), devNetName.end());
      53        3796 :     txNew.vout[0].nValue = genesisReward;
      54        3796 :     txNew.vout[0].scriptPubKey = CScript() << OP_RETURN;
      55             : 
      56        3796 :     CBlock genesis;
      57        3796 :     genesis.nTime    = nTime;
      58        3796 :     genesis.nBits    = nBits;
      59        3796 :     genesis.nNonce   = nNonce;
      60        3796 :     genesis.nVersion = 4;
      61        3796 :     genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
      62        3796 :     genesis.hashPrevBlock = prevBlockHash;
      63        3796 :     genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
      64        3796 :     return genesis;
      65        3796 : }
      66             : 
      67             : /**
      68             :  * Build the genesis block. Note that the output of its generation
      69             :  * transaction cannot be spent since it did not originally exist in the
      70             :  * database.
      71             :  *
      72             :  * CBlock(hash=00000ffd590b14, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=e0028e, nTime=1390095618, nBits=1e0ffff0, nNonce=28917698, vtx=1)
      73             :  *   CTransaction(hash=e0028e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
      74             :  *     CTxIn(COutPoint(000000, -1), coinbase 04ffff001d01044c5957697265642030392f4a616e2f3230313420546865204772616e64204578706572696d656e7420476f6573204c6976653a204f76657273746f636b2e636f6d204973204e6f7720416363657074696e6720426974636f696e73)
      75             :  *     CTxOut(nValue=50.00000000, scriptPubKey=0xA9037BAC7050C479B121CF)
      76             :  *   vMerkleTree: e0028e
      77             :  */
      78       20004 : static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
      79             : {
      80       20004 :     const char* pszTimestamp = "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins";
      81       20004 :     const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
      82       20004 :     return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
      83       20004 : }
      84             : 
      85        3796 : static CBlock FindDevNetGenesisBlock(const CBlock &prevBlock, const CAmount& reward)
      86             : {
      87        3796 :     std::string devNetName = gArgs.GetDevNetName();
      88        3796 :     assert(!devNetName.empty());
      89             : 
      90        3796 :     CBlock block = CreateDevNetGenesisBlock(prevBlock.GetHash(), devNetName, prevBlock.nTime + 1, 0, prevBlock.nBits, reward);
      91             : 
      92        3796 :     arith_uint256 bnTarget;
      93        3796 :     bnTarget.SetCompact(block.nBits);
      94             : 
      95        3797 :     for (uint32_t nNonce = 0; nNonce < UINT32_MAX; nNonce++) {
      96        3797 :         block.nNonce = nNonce;
      97             : 
      98        3797 :         uint256 hash = block.GetHash();
      99        3797 :         if (UintToArith256(hash) <= bnTarget)
     100        3796 :             return block;
     101           1 :     }
     102             : 
     103             :     // This is very unlikely to happen as we start the devnet with a very low difficulty. In many cases even the first
     104             :     // iteration of the above loop will give a result already
     105           0 :     error("FindDevNetGenesisBlock: could not find devnet genesis block for %s", devNetName);
     106           0 :     assert(false);
     107        3796 : }
     108             : 
     109       25855 : bool CChainParams::IsValidMNActivation(int nBit, int64_t timePast) const
     110             : {
     111       25855 :     assert(nBit < VERSIONBITS_NUM_BITS);
     112             : 
     113       50988 :     for (int index = 0; index < Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++index) {
     114       50879 :         if (consensus.vDeployments[index].bit == nBit) {
     115       25776 :             auto& deployment = consensus.vDeployments[index];
     116       25776 :             if (timePast > deployment.nTimeout || timePast < deployment.nStartTime) {
     117          30 :                 LogPrintf("%s: activation by bit=%d deployment='%s' is out of time range start=%lld timeout=%lld\n", __func__, nBit, VersionBitsDeploymentInfo[Consensus::DeploymentPos(index)].name, deployment.nStartTime, deployment.nTimeout);
     118          30 :                 continue;
     119             :             }
     120       25746 :             if (!deployment.useEHF) {
     121           1 :                 LogPrintf("%s: trying to set MnEHF for non-masternode activation fork bit=%d\n", __func__, nBit);
     122           1 :                 return false;
     123             :             }
     124       25745 :             LogPrintf("%s: set MnEHF for bit=%d is valid\n", __func__, nBit);
     125       25745 :             return true;
     126             :         }
     127       25103 :     }
     128         109 :     LogPrintf("%s: WARNING: unknown MnEHF fork bit=%d\n", __func__, nBit);
     129         109 :     return true;
     130       25855 : }
     131             : 
     132      115296 : void CChainParams::AddLLMQ(Consensus::LLMQType llmqType)
     133             : {
     134      115296 :     assert(!GetLLMQ(llmqType).has_value());
     135      946408 :     for (const auto& llmq_param : Consensus::available_llmqs) {
     136      946408 :         if (llmq_param.type == llmqType) {
     137      115296 :             consensus.llmqs.push_back(llmq_param);
     138      115296 :             return;
     139             :         }
     140             :     }
     141           0 :     error("CChainParams::%s: unknown LLMQ type %d", __func__, static_cast<uint8_t>(llmqType));
     142           0 :     assert(false);
     143             : }
     144             : 
     145     3819623 : std::optional<Consensus::LLMQParams> CChainParams::GetLLMQ(Consensus::LLMQType llmqType) const
     146             : {
     147    11861395 :     for (const auto& llmq_param : consensus.llmqs) {
     148    11746091 :         if (llmq_param.type == llmqType) {
     149     3704319 :             return std::make_optional(llmq_param);
     150             :         }
     151             :     }
     152      115304 :     return std::nullopt;
     153     3819623 : }
     154             : 
     155             : /**
     156             :  * Main network on which people trade goods and services.
     157             :  */
     158             : class CMainParams : public CChainParams {
     159             : public:
     160       10242 :     CMainParams() {
     161        5121 :         strNetworkID = CBaseChainParams::MAIN;
     162        5121 :         consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050)
     163        5121 :         consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
     164        5121 :         consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
     165        5121 :         consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
     166        5121 :         consensus.nInstantSendConfirmationsRequired = 6;
     167        5121 :         consensus.nInstantSendKeepLock = 24;
     168        5121 :         consensus.nBudgetPaymentsStartBlock = 328008; // actual historical value
     169        5121 :         consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
     170        5121 :         consensus.nBudgetPaymentsWindowBlocks = 100;
     171        5121 :         consensus.nSuperblockStartBlock = 614820; // The block at which 12.1 goes live (end of final 12.0 budget cycle)
     172        5121 :         consensus.nSuperblockStartHash = uint256S("0000000000020cb27c7ef164d21003d5d20cdca2f54dd9a9ca6d45f4d47f8aa3");
     173        5121 :         consensus.nSuperblockCycle = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
     174        5121 :         consensus.nSuperblockMaturityWindow = 1662; // ~(60*24*3)/2.6, ~3 days before actual Superblock is emitted
     175        5121 :         consensus.nGovernanceMinQuorum = 10;
     176        5121 :         consensus.nGovernanceFilterElements = 20000;
     177        5121 :         consensus.nMasternodeMinimumConfirmations = 15;
     178        5121 :         consensus.BIP34Height = 951;
     179        5121 :         consensus.BIP34Hash = uint256S("0x000001f35e70f7c5705f64c6c5cc3dea9449e74d5b5c7cf74dad1bcca14a8012");
     180        5121 :         consensus.BIP65Height = 619382; // 00000000000076d8fcea02ec0963de4abfd01e771fec0863f960c2c64fe6f357
     181        5121 :         consensus.BIP66Height = 245817; // 00000000000b1fa2dfa312863570e13fae9ca7b5566cb27e55422620b469aefa
     182        5121 :         consensus.BIP147Height = 939456; // 00000000000000117befca4fab5622514772f608852e5edd8df9c55464b6fe37
     183        5121 :         consensus.CSVHeight = 622944; // 00000000000002e3d3a6224cfce80bae367fd3283d1e5a8ba50e5e60b2d2905d
     184        5121 :         consensus.DIP0001Height = 782208; // 000000000000000cbc9cb551e8ee1ac7aa223585cbdfb755d3683bafd93679e4
     185        5121 :         consensus.DIP0003Height = 1028160;
     186        5121 :         consensus.DIP0003EnforcementHeight = 1047200;
     187        5121 :         consensus.DIP0003EnforcementHash = uint256S("000000000000002d1734087b4c5afc3133e4e1c3e1a89218f62bcd9bb3d17f81");
     188        5121 :         consensus.DIP0008Height = 1088640; // 00000000000000112e41e4b3afda8b233b8cc07c532d2eac5de097b68358c43e
     189        5121 :         consensus.BRRHeight = 1374912; // 000000000000000c5a124f3eccfbe6e17876dca79cec9e63dfa70d269113c926
     190        5121 :         consensus.DIP0020Height = 1516032; // 000000000000000f64ed3bd9af1078177ac026f6aa2677aa4d8beeae43be56cc
     191        5121 :         consensus.DIP0024Height = 1737792; // 0000000000000001342be9c0b75ad40c276beaad91616423c4d9cb101b3db438
     192        5121 :         consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244
     193        5121 :         consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae
     194        5121 :         consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777
     195        5121 :         consensus.MN_RRHeight = 2128896; // 0000000000000009a9696da93d3807eb14eb00a4ff449206d689156a21b27f26
     196        5121 :         consensus.WithdrawalsHeight = 2201472; // 00000000000000210518749e17c00b035a2a4982c906236c28c41ea2231bf7ef
     197        5121 :         consensus.MinBIP9WarningHeight = 2201472 + 2016; // withdrawals activation height + miner confirmation window
     198        5121 :         consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
     199        5121 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     200        5121 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     201        5121 :         consensus.fPowAllowMinDifficultyBlocks = false;
     202        5121 :         consensus.fPowNoRetargeting = false;
     203        5121 :         consensus.nPowKGWHeight = 15200;
     204        5121 :         consensus.nPowDGWHeight = 34140;
     205        5121 :         consensus.nRuleChangeActivationThreshold = 1815; // 90% of 2016
     206        5121 :         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
     207        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     208        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
     209        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     210        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     211             : 
     212        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     213        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE; // TODO
     214        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; // TODO
     215        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 4032;
     216        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 3226;     // 80% of 4032
     217        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 2420;       // 60% of 4032
     218        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;          // this corresponds to 10 periods
     219        5121 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     220             : 
     221        5121 :         consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000b9040746437784aaec47"); // 2471728
     222        5121 :         consensus.defaultAssumeValid = uint256S("0x000000000000001a19ad7270422a00f86123ea94e0b295a3a796d6861bd7b032"); // 2471728
     223             : 
     224             :         /**
     225             :          * The message start string is designed to be unlikely to occur in normal data.
     226             :          * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
     227             :          * a large 32-bit integer with any alignment.
     228             :          */
     229        5121 :         pchMessageStart[0] = 0xbf;
     230        5121 :         pchMessageStart[1] = 0x0c;
     231        5121 :         pchMessageStart[2] = 0x6b;
     232        5121 :         pchMessageStart[3] = 0xbd;
     233        5121 :         nDefaultPort = 9999;
     234        5121 :         nDefaultPlatformP2PPort = 26656;
     235        5121 :         nDefaultPlatformHTTPPort = 443;
     236        5121 :         nPruneAfterHeight = 100000;
     237        5121 :         m_assumed_blockchain_size = 57;
     238        5121 :         m_assumed_chain_state_size = 1;
     239             : 
     240        5121 :         genesis = CreateGenesisBlock(1390095618, 28917698, 0x1e0ffff0, 1, 50 * COIN);
     241        5121 :         consensus.hashGenesisBlock = genesis.GetHash();
     242        5121 :         assert(consensus.hashGenesisBlock == uint256S("0x00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6"));
     243        5121 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     244             : 
     245             :         // Note that of those which support the service bits prefix, most only support a subset of
     246             :         // possible options.
     247             :         // This is fine at runtime as we'll fall back to using them as an addrfetch if they don't support the
     248             :         // service bits we want, but we should get them updated to support all service bits wanted by any
     249             :         // release ASAP to avoid it where possible.
     250        5121 :         vSeeds.emplace_back("dnsseed.dash.org.");
     251             : 
     252             :         // Dash addresses start with 'X'
     253        5121 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,76);
     254             :         // Dash script addresses start with '7'
     255        5121 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,16);
     256             :         // Dash private keys start with '7' or 'X'
     257        5121 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,204);
     258             :         // Dash BIP32 pubkeys start with 'xpub' (Bitcoin defaults)
     259        5121 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
     260             :         // Dash BIP32 prvkeys start with 'xprv' (Bitcoin defaults)
     261        5121 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
     262             : 
     263             :         // DIP-18 Dash Platform address HRP (bech32m)
     264        5121 :         bech32_platform_hrp = "dash";
     265             : 
     266             :         // Dash BIP44 coin type is '5'
     267        5121 :         nExtCoinType = 5;
     268             : 
     269        5121 :         vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));
     270             : 
     271             :         // long living quorum params
     272        5121 :         AddLLMQ(Consensus::LLMQType::LLMQ_50_60);
     273        5121 :         AddLLMQ(Consensus::LLMQType::LLMQ_60_75);
     274        5121 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_60);
     275        5121 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_85);
     276        5121 :         AddLLMQ(Consensus::LLMQType::LLMQ_100_67);
     277        5121 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_400_60;
     278        5121 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_60_75;
     279        5121 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_100_67;
     280        5121 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_400_85;
     281             : 
     282        5121 :         fDefaultConsistencyChecks = false;
     283        5121 :         fRequireStandard = true;
     284        5121 :         fRequireRoutableExternalIP = true;
     285        5121 :         m_is_test_chain = false;
     286        5121 :         fAllowMultipleAddressesFromGroup = false;
     287        5121 :         nLLMQConnectionRetryTimeout = 60;
     288        5121 :         m_is_mockable_chain = false;
     289             : 
     290        5121 :         nPoolMinParticipants = 3;
     291        5121 :         nPoolMaxParticipants = 20;
     292        5121 :         nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour
     293             : 
     294        5121 :         vSporkAddresses = {"Xgtyuk76vhuFW2iT7UAiHgNdWXCf3J34wh"};
     295        5121 :         nMinSporkKeys = 1;
     296             : 
     297        5121 :         nCreditPoolPeriodBlocks = 576;
     298             : 
     299       10242 :         checkpointData = {
     300        5121 :             {
     301        5121 :                 {1500, uint256S("0x000000aaf0300f59f49bc3e970bad15c11f961fe2347accffff19d96ec9778e3")},
     302        5121 :                 {4991, uint256S("0x000000003b01809551952460744d5dbb8fcbd6cbae3c220267bf7fa43f837367")},
     303        5121 :                 {9918, uint256S("0x00000000213e229f332c0ffbe34defdaa9e74de87f2d8d1f01af8d121c3c170b")},
     304        5121 :                 {16912, uint256S("0x00000000075c0d10371d55a60634da70f197548dbbfa4123e12abfcbc5738af9")},
     305        5121 :                 {23912, uint256S("0x0000000000335eac6703f3b1732ec8b2f89c3ba3a7889e5767b090556bb9a276")},
     306        5121 :                 {35457, uint256S("0x0000000000b0ae211be59b048df14820475ad0dd53b9ff83b010f71a77342d9f")},
     307        5121 :                 {45479, uint256S("0x000000000063d411655d590590e16960f15ceea4257122ac430c6fbe39fbf02d")},
     308        5121 :                 {55895, uint256S("0x0000000000ae4c53a43639a4ca027282f69da9c67ba951768a20415b6439a2d7")},
     309        5121 :                 {68899, uint256S("0x0000000000194ab4d3d9eeb1f2f792f21bb39ff767cb547fe977640f969d77b7")},
     310        5121 :                 {74619, uint256S("0x000000000011d28f38f05d01650a502cc3f4d0e793fbc26e2a2ca71f07dc3842")},
     311        5121 :                 {75095, uint256S("0x0000000000193d12f6ad352a9996ee58ef8bdc4946818a5fec5ce99c11b87f0d")},
     312        5121 :                 {88805, uint256S("0x00000000001392f1652e9bf45cd8bc79dc60fe935277cd11538565b4a94fa85f")},
     313        5121 :                 {107996, uint256S("0x00000000000a23840ac16115407488267aa3da2b9bc843e301185b7d17e4dc40")},
     314        5121 :                 {137993, uint256S("0x00000000000cf69ce152b1bffdeddc59188d7a80879210d6e5c9503011929c3c")},
     315        5121 :                 {167996, uint256S("0x000000000009486020a80f7f2cc065342b0c2fb59af5e090cd813dba68ab0fed")},
     316        5121 :                 {207992, uint256S("0x00000000000d85c22be098f74576ef00b7aa00c05777e966aff68a270f1e01a5")},
     317        5121 :                 {312645, uint256S("0x0000000000059dcb71ad35a9e40526c44e7aae6c99169a9e7017b7d84b1c2daf")},
     318        5121 :                 {407452, uint256S("0x000000000003c6a87e73623b9d70af7cd908ae22fee466063e4ffc20be1d2dbc")},
     319        5121 :                 {523412, uint256S("0x000000000000e54f036576a10597e0e42cc22a5159ce572f999c33975e121d4d")},
     320        5121 :                 {523930, uint256S("0x0000000000000bccdb11c2b1cfb0ecab452abf267d89b7f46eaf2d54ce6e652c")},
     321        5121 :                 {750000, uint256S("0x00000000000000b4181bbbdddbae464ce11fede5d0292fb63fdede1e7c8ab21c")},
     322        5121 :                 {888900, uint256S("0x0000000000000026c29d576073ab51ebd1d3c938de02e9a44c7ee9e16f82db28")},
     323        5121 :                 {967800, uint256S("0x0000000000000024e26c7df7e46d673724d223cf4ca2b2adc21297cc095600f4")},
     324        5121 :                 {1067570, uint256S("0x000000000000001e09926bcf5fa4513d23e870a34f74e38200db99eb3f5b7a70")},
     325        5121 :                 {1167570, uint256S("0x000000000000000fb7b1e9b81700283dff0f7d87cf458e5edfdae00c669de661")},
     326        5121 :                 {1364585, uint256S("0x00000000000000022f355c52417fca9b73306958f7c0832b3a7bce006ca369ef")},
     327        5121 :                 {1450000, uint256S("0x00000000000000105cfae44a995332d8ec256850ea33a1f7b700474e3dad82bc")},
     328        5121 :                 {1796500, uint256S("0x000000000000001d531f36005159f19351bd49ca676398a561e55dcccb84eacd")},
     329        5121 :                 {1850400, uint256S("0x00000000000000261bdbe99c01fcba992e577efa6cc41aae564b8ca9f112b2a3")},
     330        5121 :                 {1889000, uint256S("0x00000000000000075300e852d5bf5380f905b2768241f8b442498442084807a7")},
     331        5121 :                 {1969000, uint256S("0x000000000000000c8b7a3bdcd8b9f516462122314529c8342244c685a4c899bf")},
     332        5121 :                 {2029000, uint256S("0x0000000000000020d5e38b6aef5bc8e430029444d7977b46f710c7d281ef1281")},
     333        5121 :                 {2109672, uint256S("0x000000000000001889bd33ef019065e250d32bd46911f4003d3fdd8128b5358d")},
     334        5121 :                 {2175051, uint256S("0x000000000000001cf26547602d982dcaa909231bbcd1e70c0eb3c65de25473ba")},
     335        5121 :                 {2216986, uint256S("0x0000000000000010b1135dc743f27f6fc8a138c6420a9d963fc676f96c2048f4")},
     336        5121 :                 {2361500, uint256S("0x0000000000000009ba1e8f47851d036bb618a4f6565eb3c32d1f647d450ff195")},
     337        5121 :                 {2421800, uint256S("0x000000000000000718ed026ebd644a8b70b42d4cbd7b25304c066c9bf15f85b7")},
     338        5121 :                 {2471728, uint256S("0x000000000000001a19ad7270422a00f86123ea94e0b295a3a796d6861bd7b032")},
     339             :             }
     340             :         };
     341             : 
     342        5121 :         m_assumeutxo_data = MapAssumeutxo{
     343             :          // TODO to be specified in a future patch.
     344             :         };
     345             : 
     346             :         // getchaintxstats 17280 000000000000001a19ad7270422a00f86123ea94e0b295a3a796d6861bd7b032
     347        5121 :         chainTxData = ChainTxData{
     348             :                 1778832687, // * UNIX timestamp of last known number of transactions (Block 2471728)
     349             :                 69379403,   // * total number of transactions between genesis and that timestamp
     350             :                             //   (the tx=... number in the ChainStateFlushed debug.log lines)
     351             :                 0.1476929741159368,      // * estimated number of transactions per second after that timestamp
     352             :         };
     353       10242 :     }
     354             : };
     355             : 
     356             : /**
     357             :  * Testnet (v3): public test network which is reset from time to time.
     358             :  */
     359             : class CTestNetParams : public CChainParams {
     360             : public:
     361        7776 :     CTestNetParams() {
     362        3888 :         strNetworkID = CBaseChainParams::TESTNET;
     363        3888 :         consensus.nSubsidyHalvingInterval = 210240;
     364        3888 :         consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
     365        3888 :         consensus.nMasternodePaymentsIncreaseBlock = 4030;
     366        3888 :         consensus.nMasternodePaymentsIncreasePeriod = 10;
     367        3888 :         consensus.nInstantSendConfirmationsRequired = 2;
     368        3888 :         consensus.nInstantSendKeepLock = 6;
     369        3888 :         consensus.nBudgetPaymentsStartBlock = 4100;
     370        3888 :         consensus.nBudgetPaymentsCycleBlocks = 50;
     371        3888 :         consensus.nBudgetPaymentsWindowBlocks = 10;
     372        3888 :         consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
     373        3888 :         consensus.nSuperblockStartHash = uint256(); // do not check this on testnet
     374        3888 :         consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
     375        3888 :         consensus.nSuperblockMaturityWindow = 8;
     376        3888 :         consensus.nGovernanceMinQuorum = 1;
     377        3888 :         consensus.nGovernanceFilterElements = 500;
     378        3888 :         consensus.nMasternodeMinimumConfirmations = 1;
     379        3888 :         consensus.BIP34Height = 76;
     380        3888 :         consensus.BIP34Hash = uint256S("0x000008ebb1db2598e897d17275285767717c6acfeac4c73def49fbea1ddcbcb6");
     381        3888 :         consensus.BIP65Height = 2431; // 0000039cf01242c7f921dcb4806a5994bc003b48c1973ae0c89b67809c2bb2ab
     382        3888 :         consensus.BIP66Height = 2075; // 0000002acdd29a14583540cb72e1c5cc83783560e38fa7081495d474fe1671f7
     383        3888 :         consensus.BIP147Height = 4300; // 0000000040c1480d413c9203664253ab18da284130c329bf88fcfc84312bcbe0
     384        3888 :         consensus.CSVHeight = 8064; // 00000005eb94d027e34649373669191188858a22c70f4a6d29105e559124cec7
     385        3888 :         consensus.DIP0001Height = 5500; // 00000001d60a01d8f1f39011cc6b26e3a1c97a24238cab856c2da71a4dd801a9
     386        3888 :         consensus.DIP0003Height = 7000;
     387        3888 :         consensus.DIP0003EnforcementHeight = 7300;
     388        3888 :         consensus.DIP0003EnforcementHash = uint256S("00000055ebc0e974ba3a3fb785c5ad4365a39637d4df168169ee80d313612f8f");
     389        3888 :         consensus.DIP0008Height = 78800; // 000000000e9329d964d80e7dab2e704b43b6bd2b91fea1e9315d38932e55fb55
     390        3888 :         consensus.BRRHeight = 387500; // 0000001537dbfd09dea69f61c1f8b2afa27c8dc91c934e144797761c9f10367b
     391        3888 :         consensus.DIP0020Height = 414100; // 000000cf961868662fbfbb5d1af6f1caa1809f6a4e390efe5f8cd3031adea668
     392        3888 :         consensus.DIP0024Height = 769700; // 0000008d84e4efd890ae95c70a7a6126a70a80e5c19e4cb264a5b3469aeef172
     393        3888 :         consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e
     394        3888 :         consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b
     395        3888 :         consensus.V20Height = 905100; // 0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd
     396        3888 :         consensus.MN_RRHeight = 1066900; // 000000d05d445958a9a4ad6bdc0f4bfb25af124b2326060703373ff2d3b397e9
     397        3888 :         consensus.WithdrawalsHeight = 1148500; // 000000212a6fec2ee2af040c6d7a176360b154cbaa998888170cfd9ae7dd632d
     398        3888 :         consensus.MinBIP9WarningHeight = 1148500 + 2016;  // withdrawals activation height + miner confirmation window
     399        3888 :         consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
     400        3888 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     401        3888 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     402        3888 :         consensus.fPowAllowMinDifficultyBlocks = true;
     403        3888 :         consensus.fPowNoRetargeting = false;
     404        3888 :         consensus.nPowKGWHeight = 4002; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
     405        3888 :         consensus.nPowDGWHeight = 4002; // TODO: make sure to drop all spork6 related code on next testnet reset
     406        3888 :         consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
     407        3888 :         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
     408        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     409        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
     410        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     411        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     412             : 
     413        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     414        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE; // TODO
     415        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     416        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 100;
     417        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 80;       // 80% of 100
     418        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 60;         // 60% of 100
     419        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;          // this corresponds to 10 periods
     420        3888 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     421             : 
     422        3888 :         consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000036c8f738da818d2"); // 1400000
     423        3888 :         consensus.defaultAssumeValid = uint256S("0x000000541a23f9db7411cddbe50f9f1ebd4aa7108ebdcad62214753f648c0239"); // 1400000
     424             : 
     425        3888 :         pchMessageStart[0] = 0xce;
     426        3888 :         pchMessageStart[1] = 0xe2;
     427        3888 :         pchMessageStart[2] = 0xca;
     428        3888 :         pchMessageStart[3] = 0xff;
     429        3888 :         nDefaultPort = 19999;
     430        3888 :         nDefaultPlatformP2PPort = 22000;
     431        3888 :         nDefaultPlatformHTTPPort = 22001;
     432        3888 :         nPruneAfterHeight = 1000;
     433        3888 :         m_assumed_blockchain_size = 10;
     434        3888 :         m_assumed_chain_state_size = 1;
     435             : 
     436        3888 :         genesis = CreateGenesisBlock(1390666206UL, 3861367235UL, 0x1e0ffff0, 1, 50 * COIN);
     437        3888 :         consensus.hashGenesisBlock = genesis.GetHash();
     438        3888 :         assert(consensus.hashGenesisBlock == uint256S("0x00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c"));
     439        3888 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     440             : 
     441        3888 :         vFixedSeeds.clear();
     442        3888 :         vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));
     443             : 
     444        3888 :         vSeeds.clear();
     445             :         // nodes with support for servicebits filtering should be at the top
     446        3888 :         vSeeds.emplace_back("testnet-seed.dashdot.io."); // Just a static list of stable node(s), only supports x9
     447             : 
     448             :         // Testnet Dash addresses start with 'y'
     449        3888 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
     450             :         // Testnet Dash script addresses start with '8' or '9'
     451        3888 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
     452             :         // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
     453        3888 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
     454             :         // Testnet Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
     455        3888 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
     456             :         // Testnet Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
     457        3888 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     458             : 
     459             :         // DIP-18 Dash Platform address HRP (bech32m)
     460        3888 :         bech32_platform_hrp = "tdash";
     461             : 
     462             :         // Testnet Dash BIP44 coin type is '1' (All coin's testnet default)
     463        3888 :         nExtCoinType = 1;
     464             : 
     465             :         // long living quorum params
     466        3888 :         AddLLMQ(Consensus::LLMQType::LLMQ_50_60);
     467        3888 :         AddLLMQ(Consensus::LLMQType::LLMQ_60_75);
     468        3888 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_60);
     469        3888 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_85);
     470        3888 :         AddLLMQ(Consensus::LLMQType::LLMQ_100_67);
     471        3888 :         AddLLMQ(Consensus::LLMQType::LLMQ_25_67);
     472        3888 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_50_60;
     473        3888 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_60_75;
     474        3888 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_25_67;
     475        3888 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_50_60;
     476             : 
     477        3888 :         fDefaultConsistencyChecks = false;
     478        3888 :         fRequireStandard = false;
     479        3888 :         fRequireRoutableExternalIP = true;
     480        3888 :         m_is_test_chain = true;
     481        3888 :         fAllowMultipleAddressesFromGroup = false;
     482        3888 :         nLLMQConnectionRetryTimeout = 60;
     483        3888 :         m_is_mockable_chain = false;
     484             : 
     485        3888 :         nPoolMinParticipants = 2;
     486        3888 :         nPoolMaxParticipants = 20;
     487        3888 :         nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
     488             : 
     489        3888 :         vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"};
     490        3888 :         nMinSporkKeys = 1;
     491             : 
     492        3888 :         nCreditPoolPeriodBlocks = 576;
     493             : 
     494        7776 :         checkpointData = {
     495        3888 :             {
     496        3888 :                 {255, uint256S("0x0000080b600e06f4c07880673f027210f9314575f5f875fafe51971e268b886a")},
     497        3888 :                 {261, uint256S("0x00000c26026d0815a7e2ce4fa270775f61403c040647ff2c3091f99e894a4618")},
     498        3888 :                 {1999, uint256S("0x00000052e538d27fa53693efe6fb6892a0c1d26c0235f599171c48a3cce553b1")},
     499        3888 :                 {2999, uint256S("0x0000024bc3f4f4cb30d29827c13d921ad77d2c6072e586c7f60d83c2722cdcc5")},
     500        3888 :                 {96090, uint256S("0x00000000033df4b94d17ab43e999caaf6c4735095cc77703685da81254d09bba")},
     501        3888 :                 {200000, uint256S("0x000000001015eb5ef86a8fe2b3074d947bc972c5befe32b28dd5ce915dc0d029")},
     502        3888 :                 {395750, uint256S("0x000008b78b6aef3fd05ab78db8b76c02163e885305545144420cb08704dce538")},
     503        3888 :                 {470000, uint256S("0x0000009303aeadf8cf3812f5c869691dbd4cb118ad20e9bf553be434bafe6a52")},
     504        3888 :                 {794950, uint256S("0x000001860e4c7248a9c5cc3bc7106041750560dc5cd9b3a2641b49494bcff5f2")},
     505        3888 :                 {808000, uint256S("0x00000104cb60a2b5e00a8a4259582756e5bf0dca201c0993c63f0e54971ea91a")},
     506        3888 :                 {840000, uint256S("0x000000cd7c3084499912ae893125c13e8c3c656abb6e511dcec6619c3d65a510")},
     507        3888 :                 {851000, uint256S("0x0000014d3b875540ff75517b7fbb1714e25d50ce92f65d7086cfce357928bb02")},
     508        3888 :                 {905100, uint256S("0x0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd")},
     509        3888 :                 {960000, uint256S("0x0000000386cf5061ea16404c66deb83eb67892fa4f79b9e58e5eaab097ec2bd6")},
     510        3888 :                 {1069875, uint256S("0x00000034bfeb926662ba547c0b8dd4ba8cbb6e0c581f4e7d1bddce8f9ca3a608")},
     511        3888 :                 {1143608, uint256S("0x000000eef20eb0062abd4e799967e98bdebb165dd1c567ab4118c1c86c6e948f")},
     512        3888 :                 {1189000, uint256S("0x000001690314036dfbbecbdf382b230ead8e9c584241290a51f9f05a87a9cf7e")},
     513        3888 :                 {1295700, uint256S("0x00000107d42829a38e31c1a38c660d621e1ca376a880df1520e85e38af175d3a")},
     514        3888 :                 {1380000, uint256S("0x000000a98084beaf77ed26a905a7d59979009e23367a55b5d634962d7d65a1f9")},
     515             :             }
     516             :         };
     517             : 
     518        3888 :         m_assumeutxo_data = MapAssumeutxo{
     519             :             // TODO to be specified in a future patch.
     520             :         };
     521             : 
     522             :         // getchaintxstats 17280 000000a98084beaf77ed26a905a7d59979009e23367a55b5d634962d7d65a1f9
     523        3888 :         chainTxData = ChainTxData{
     524             :                 1765334452, // * UNIX timestamp of last known number of transactions (Block 1380000)
     525             :                 8182713,    // * total number of transactions between genesis and that timestamp
     526             :                             //   (the tx=... number in the ChainStateFlushed debug.log lines)
     527             :                 0.1796716675173412,       // * estimated number of transactions per second after that timestamp
     528             :         };
     529        7776 :     }
     530             : };
     531             : 
     532             : /**
     533             :  * Devnet: The Development network intended for developers use.
     534             :  */
     535             : class CDevNetParams : public CChainParams {
     536             : public:
     537        7592 :     explicit CDevNetParams(const ArgsManager& args) {
     538        3796 :         strNetworkID = CBaseChainParams::DEVNET;
     539        3796 :         consensus.nSubsidyHalvingInterval = 210240;
     540        3796 :         consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
     541        3796 :         consensus.nMasternodePaymentsIncreaseBlock = 4030;
     542        3796 :         consensus.nMasternodePaymentsIncreasePeriod = 10;
     543        3796 :         consensus.nInstantSendConfirmationsRequired = 2;
     544        3796 :         consensus.nInstantSendKeepLock = 6;
     545        3796 :         consensus.nBudgetPaymentsStartBlock = 4100;
     546        3796 :         consensus.nBudgetPaymentsCycleBlocks = 50;
     547        3796 :         consensus.nBudgetPaymentsWindowBlocks = 10;
     548        3796 :         consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
     549        3796 :         consensus.nSuperblockStartHash = uint256(); // do not check this on devnet
     550        3796 :         consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on devnet
     551        3796 :         consensus.nSuperblockMaturityWindow = 8;
     552        3796 :         consensus.nGovernanceMinQuorum = 1;
     553        3796 :         consensus.nGovernanceFilterElements = 500;
     554        3796 :         consensus.nMasternodeMinimumConfirmations = 1;
     555        3796 :         consensus.BIP34Height = 1;   // BIP34 activated immediately on devnet
     556        3796 :         consensus.BIP65Height = 1;   // BIP65 activated immediately on devnet
     557        3796 :         consensus.BIP66Height = 1;   // BIP66 activated immediately on devnet
     558        3796 :         consensus.BIP147Height = 1;  // BIP147 activated immediately on devnet
     559        3796 :         consensus.CSVHeight = 1;     // BIP68 activated immediately on devnet
     560        3796 :         consensus.DIP0001Height = 2; // DIP0001 activated immediately on devnet
     561        3796 :         consensus.DIP0003Height = 2; // DIP0003 activated immediately on devnet
     562        3796 :         consensus.DIP0003EnforcementHeight = 2; // DIP0003 activated immediately on devnet
     563        3796 :         consensus.DIP0003EnforcementHash = uint256();
     564        3796 :         consensus.DIP0008Height = 2; // DIP0008 activated immediately on devnet
     565        3796 :         consensus.BRRHeight = 2;     // BRR (realloc) activated immediately on devnet
     566        3796 :         consensus.DIP0020Height = 2; // DIP0020 activated immediately on devnet
     567        3796 :         consensus.DIP0024Height = 2; // DIP0024 activated immediately on devnet
     568        3796 :         consensus.DIP0024QuorumsHeight = 2; // DIP0024 activated immediately on devnet
     569        3796 :         consensus.V19Height = 2;     // V19 activated immediately on devnet
     570        3796 :         consensus.V20Height = 2;     // V20 activated immediately on devnet
     571        3796 :         consensus.MN_RRHeight = 2;   // MN_RR activated immediately on devnet
     572        3796 :         consensus.WithdrawalsHeight = 2;   // withdrawals activated immediately on devnet
     573        3796 :         consensus.MinBIP9WarningHeight = 2 + 2016; // withdrawals activation height + miner confirmation window
     574        3796 :         consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
     575        3796 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     576        3796 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     577        3796 :         consensus.fPowAllowMinDifficultyBlocks = true;
     578        3796 :         consensus.fPowNoRetargeting = false;
     579        3796 :         consensus.nPowKGWHeight = 4001; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
     580        3796 :         consensus.nPowDGWHeight = 4001;
     581        3796 :         consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
     582        3796 :         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
     583        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     584        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
     585        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     586        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     587             : 
     588        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     589        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = 1751328000;    // July 1, 2025
     590        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     591        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 120;
     592        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 96;       // 80% of 120
     593        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 72;         // 60% of 120
     594        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;          // this corresponds to 10 periods
     595        3796 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     596             : 
     597        3796 :         consensus.nMinimumChainWork = uint256{};
     598        3796 :         consensus.defaultAssumeValid = uint256{};
     599             : 
     600        3796 :         pchMessageStart[0] = 0xe2;
     601        3796 :         pchMessageStart[1] = 0xca;
     602        3796 :         pchMessageStart[2] = 0xff;
     603        3796 :         pchMessageStart[3] = 0xce;
     604        3796 :         nDefaultPort = 19799;
     605        3796 :         nDefaultPlatformP2PPort = 22100;
     606        3796 :         nDefaultPlatformHTTPPort = 22101;
     607        3796 :         nPruneAfterHeight = 1000;
     608        3796 :         m_assumed_blockchain_size = 0;
     609        3796 :         m_assumed_chain_state_size = 0;
     610             : 
     611        3796 :         UpdateDevnetSubsidyAndDiffParametersFromArgs(args);
     612        3796 :         genesis = CreateGenesisBlock(1417713337, 1096447, 0x207fffff, 1, 50 * COIN);
     613        3796 :         consensus.hashGenesisBlock = genesis.GetHash();
     614        3796 :         assert(consensus.hashGenesisBlock == uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"));
     615        3796 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     616             : 
     617        3796 :         devnetGenesis = FindDevNetGenesisBlock(genesis, 50 * COIN);
     618        3796 :         consensus.hashDevnetGenesisBlock = devnetGenesis.GetHash();
     619             : 
     620        3796 :         vFixedSeeds.clear();
     621        3796 :         vSeeds.clear();
     622             :         //vSeeds.push_back(CDNSSeedData("dashevo.org.",  "devnet-seed.dashevo.org."));
     623             : 
     624             :         // Testnet Dash addresses start with 'y'
     625        3796 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
     626             :         // Testnet Dash script addresses start with '8' or '9'
     627        3796 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
     628             :         // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
     629        3796 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
     630             :         // Testnet Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
     631        3796 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
     632             :         // Testnet Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
     633        3796 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     634             : 
     635             :         // DIP-18 Dash Platform address HRP (bech32m)
     636        3796 :         bech32_platform_hrp = "tdash";
     637             : 
     638             :         // Testnet Dash BIP44 coin type is '1' (All coin's testnet default)
     639        3796 :         nExtCoinType = 1;
     640             : 
     641             :         // long living quorum params
     642        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_50_60);
     643        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_60_75);
     644        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_60);
     645        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_85);
     646        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_100_67);
     647        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_DEVNET);
     648        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_DEVNET_DIP0024);
     649        3796 :         AddLLMQ(Consensus::LLMQType::LLMQ_DEVNET_PLATFORM);
     650        3796 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_DEVNET;
     651        3796 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_DEVNET_DIP0024;
     652        3796 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_DEVNET_PLATFORM;
     653        3796 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_DEVNET;
     654             : 
     655        3796 :         UpdateDevnetLLMQChainLocksFromArgs(args);
     656        3796 :         UpdateDevnetLLMQInstantSendDIP0024FromArgs(args);
     657        3796 :         UpdateDevnetLLMQPlatformFromArgs(args);
     658        3796 :         UpdateDevnetLLMQMnhfFromArgs(args);
     659        3796 :         UpdateLLMQDevnetParametersFromArgs(args);
     660        3796 :         UpdateDevnetPowTargetSpacingFromArgs(args);
     661             : 
     662        3796 :         fDefaultConsistencyChecks = false;
     663        3796 :         fRequireStandard = false;
     664        3796 :         fRequireRoutableExternalIP = true;
     665        3796 :         m_is_test_chain = true;
     666        3796 :         fAllowMultipleAddressesFromGroup = true;
     667        3796 :         nLLMQConnectionRetryTimeout = 60;
     668        3796 :         m_is_mockable_chain = false;
     669             : 
     670        3796 :         nPoolMinParticipants = 2;
     671        3796 :         nPoolMaxParticipants = 20;
     672        3796 :         nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
     673             : 
     674        3796 :         vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"};
     675        3796 :         nMinSporkKeys = 1;
     676             : 
     677        3796 :         nCreditPoolPeriodBlocks = 576;
     678             : 
     679        7592 :         checkpointData = (CCheckpointData) {
     680        3796 :             {
     681        3796 :                 { 0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")},
     682        3796 :                 { 1, devnetGenesis.GetHash() },
     683             :             }
     684             :         };
     685             : 
     686        3796 :         chainTxData = ChainTxData{
     687        3796 :             devnetGenesis.GetBlockTime(), // * UNIX timestamp of devnet genesis block
     688             :             2,                            // * we only have 2 coinbase transactions when a devnet is started up
     689             :             0.01                          // * estimated number of transactions per second
     690             :         };
     691        7592 :     }
     692             : 
     693             :     /**
     694             :      * Allows modifying the subsidy and difficulty devnet parameters.
     695             :      */
     696           0 :     void UpdateDevnetSubsidyAndDiffParameters(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor)
     697             :     {
     698           0 :         consensus.nMinimumDifficultyBlocks = nMinimumDifficultyBlocks;
     699           0 :         consensus.nHighSubsidyBlocks = nHighSubsidyBlocks;
     700           0 :         consensus.nHighSubsidyFactor = nHighSubsidyFactor;
     701           0 :     }
     702             :     void UpdateDevnetSubsidyAndDiffParametersFromArgs(const ArgsManager& args);
     703             : 
     704             :     /**
     705             :      * Allows modifying the LLMQ type for ChainLocks.
     706             :      */
     707           0 :     void UpdateDevnetLLMQChainLocks(Consensus::LLMQType llmqType)
     708             :     {
     709           0 :         consensus.llmqTypeChainLocks = llmqType;
     710           0 :     }
     711             :     void UpdateDevnetLLMQChainLocksFromArgs(const ArgsManager& args);
     712             : 
     713             :     /**
     714             :      * Allows modifying the LLMQ type for InstantSend (DIP0024).
     715             :      */
     716           0 :     void UpdateDevnetLLMQDIP0024InstantSend(Consensus::LLMQType llmqType)
     717             :     {
     718           0 :         consensus.llmqTypeDIP0024InstantSend = llmqType;
     719           0 :     }
     720             : 
     721             :     /**
     722             :      * Allows modifying the LLMQ type for Platform.
     723             :      */
     724           0 :     void UpdateDevnetLLMQPlatform(Consensus::LLMQType llmqType)
     725             :     {
     726           0 :         consensus.llmqTypePlatform = llmqType;
     727           0 :     }
     728             : 
     729             :     /**
     730             :      * Allows modifying the LLMQ type for Mnhf.
     731             :      */
     732           0 :     void UpdateDevnetLLMQMnhf(Consensus::LLMQType llmqType)
     733             :     {
     734           0 :         consensus.llmqTypeMnhf = llmqType;
     735           0 :     }
     736             : 
     737             :     /**
     738             :      * Allows modifying PowTargetSpacing
     739             :      */
     740           0 :     void UpdateDevnetPowTargetSpacing(int64_t nPowTargetSpacing)
     741             :     {
     742           0 :         consensus.nPowTargetSpacing = nPowTargetSpacing;
     743           0 :     }
     744             : 
     745             :     /**
     746             :      * Allows modifying parameters of the devnet LLMQ
     747             :      */
     748           0 :     void UpdateLLMQDevnetParameters(int size, int threshold)
     749             :     {
     750           0 :         auto params = std::ranges::find_if(consensus.llmqs, [](const auto& llmq){ return llmq.type == Consensus::LLMQType::LLMQ_DEVNET;});
     751           0 :         assert(params != consensus.llmqs.end());
     752           0 :         params->size = size;
     753           0 :         params->minSize = threshold;
     754           0 :         params->threshold = threshold;
     755           0 :         params->dkgBadVotesThreshold = threshold;
     756           0 :     }
     757             :     void UpdateLLMQDevnetParametersFromArgs(const ArgsManager& args);
     758             :     void UpdateDevnetLLMQInstantSendFromArgs(const ArgsManager& args);
     759             :     void UpdateDevnetLLMQInstantSendDIP0024FromArgs(const ArgsManager& args);
     760             :     void UpdateDevnetLLMQPlatformFromArgs(const ArgsManager& args);
     761             :     void UpdateDevnetLLMQMnhfFromArgs(const ArgsManager& args);
     762             :     void UpdateDevnetPowTargetSpacingFromArgs(const ArgsManager& args);
     763             : };
     764             : 
     765             : /**
     766             :  * Regression test: intended for private networks only. Has minimal difficulty to ensure that
     767             :  * blocks can be found instantly.
     768             :  */
     769             : class CRegTestParams : public CChainParams {
     770             : public:
     771       14422 :     explicit CRegTestParams(const ArgsManager& args) {
     772        7211 :         strNetworkID =  CBaseChainParams::REGTEST;
     773        7211 :         consensus.nSubsidyHalvingInterval = 150;
     774        7211 :         consensus.nMasternodePaymentsStartBlock = 240;
     775        7211 :         consensus.nMasternodePaymentsIncreaseBlock = 350;
     776        7211 :         consensus.nMasternodePaymentsIncreasePeriod = 10;
     777        7211 :         consensus.nInstantSendConfirmationsRequired = 2;
     778        7211 :         consensus.nInstantSendKeepLock = 6;
     779        7211 :         consensus.nBudgetPaymentsStartBlock = 1000;
     780        7211 :         consensus.nBudgetPaymentsCycleBlocks = 50;
     781        7211 :         consensus.nBudgetPaymentsWindowBlocks = 10;
     782        7211 :         consensus.nSuperblockStartBlock = 1500;
     783        7211 :         consensus.nSuperblockStartHash = uint256(); // do not check this on regtest
     784        7211 :         consensus.nSuperblockCycle = 20;
     785        7211 :         consensus.nSuperblockMaturityWindow = 10;
     786        7211 :         consensus.nGovernanceMinQuorum = 1;
     787        7211 :         consensus.nGovernanceFilterElements = 100;
     788        7211 :         consensus.nMasternodeMinimumConfirmations = 1;
     789        7211 :         consensus.BIP34Height = 1;   // Always active unless overridden
     790        7211 :         consensus.BIP34Hash = uint256();
     791        7211 :         consensus.BIP65Height = 1;   // Always active unless overridden
     792        7211 :         consensus.BIP66Height = 1;   // Always active unless overridden
     793        7211 :         consensus.BIP147Height = 0;  // Always active unless overridden
     794        7211 :         consensus.CSVHeight = 1;     // Always active unless overridden
     795        7211 :         consensus.DIP0001Height = 1; // Always active unless overridden
     796        7211 :         consensus.DIP0003Height = 432; // Always active for DashTestFramework in functional tests (see dip3params)
     797             :                                        // For unit tests and for BitcoinTestFramework is disabled due to missing quorum commitment for blocks created by helpers such as create_blocks
     798        7211 :         consensus.DIP0003EnforcementHeight = 500;
     799        7211 :         consensus.DIP0003EnforcementHash = uint256();
     800        7211 :         consensus.DIP0008Height = 1; // Always active unless overridden
     801        7211 :         consensus.BRRHeight = 1;     // Always active unless overridden
     802        7211 :         consensus.DIP0020Height = 1; // Always active unless overridden
     803        7211 :         consensus.DIP0024Height = 1; // Always have dip0024 quorums unless overridden
     804        7211 :         consensus.DIP0024QuorumsHeight = 1; // Always have dip0024 quorums unless overridden
     805        7211 :         consensus.V19Height = 1; // Always active unless overridden
     806        7211 :         consensus.V20Height = consensus.DIP0003Height; // Active not earlier than dip0003. Functional tests (DashTestFramework) uses height 100 (same as coinbase maturity)
     807        7211 :         consensus.MN_RRHeight = consensus.V20Height; // MN_RR does not really have effect before v20 activation
     808        7211 :         consensus.WithdrawalsHeight = 600;
     809        7211 :         consensus.MinBIP9WarningHeight = 0;
     810        7211 :         consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
     811        7211 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     812        7211 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     813        7211 :         consensus.fPowAllowMinDifficultyBlocks = true;
     814        7211 :         consensus.fPowNoRetargeting = true;
     815        7211 :         consensus.nPowKGWHeight = 15200; // same as mainnet
     816        7211 :         consensus.nPowDGWHeight = 34140; // same as mainnet
     817        7211 :         consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
     818        7211 :         consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
     819             : 
     820        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     821        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
     822        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     823        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     824             : 
     825        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     826        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = 0;
     827        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     828        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 250;
     829        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 250 / 5 * 4;     // 80% of window size
     830        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 250 / 5 * 3;       // 60% of window size
     831        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;                 // this corresponds to 10 periods
     832        7211 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     833             : 
     834        7211 :         consensus.nMinimumChainWork = uint256{};
     835        7211 :         consensus.defaultAssumeValid = uint256{};
     836             : 
     837        7211 :         pchMessageStart[0] = 0xfc;
     838        7211 :         pchMessageStart[1] = 0xc1;
     839        7211 :         pchMessageStart[2] = 0xb7;
     840        7211 :         pchMessageStart[3] = 0xdc;
     841        7211 :         nDefaultPort = 19899;
     842        7211 :         nDefaultPlatformP2PPort = 22200;
     843        7211 :         nDefaultPlatformHTTPPort = 22201;
     844        7211 :         nPruneAfterHeight = args.GetBoolArg("-fastprune", false) ? 100 : 1000;
     845        7211 :         m_assumed_blockchain_size = 0;
     846        7211 :         m_assumed_chain_state_size = 0;
     847             : 
     848        7211 :         UpdateActivationParametersFromArgs(args);
     849        7199 :         UpdateDIP3ParametersFromArgs(args);
     850        7199 :         UpdateBudgetParametersFromArgs(args);
     851             : 
     852        7199 :         genesis = CreateGenesisBlock(1417713337, 1096447, 0x207fffff, 1, 50 * COIN);
     853        7199 :         consensus.hashGenesisBlock = genesis.GetHash();
     854        7199 :         assert(consensus.hashGenesisBlock == uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"));
     855        7199 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     856             : 
     857        7199 :         vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
     858        7199 :         vSeeds.clear();
     859        7199 :         vSeeds.emplace_back("dummySeed.invalid.");
     860             : 
     861        7199 :         fDefaultConsistencyChecks = true;
     862        7199 :         fRequireStandard = true;
     863        7199 :         fRequireRoutableExternalIP = false;
     864        7199 :         m_is_test_chain = true;
     865        7199 :         fAllowMultipleAddressesFromGroup = true;
     866        7199 :         nLLMQConnectionRetryTimeout = 1; // must be lower then the LLMQ signing session timeout so that tests have control over failing behavior
     867        7199 :         m_is_mockable_chain = true;
     868             : 
     869        7199 :         nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
     870        7199 :         nPoolMinParticipants = 2;
     871        7199 :         nPoolMaxParticipants = 20;
     872             : 
     873             :         // privKey: cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK
     874        7199 :         vSporkAddresses = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"};
     875        7199 :         nMinSporkKeys = 1;
     876             : 
     877        7199 :         nCreditPoolPeriodBlocks = 100;
     878             : 
     879       14398 :         checkpointData = {
     880        7199 :             {
     881        7199 :                 {0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")},
     882             :             }
     883             :         };
     884             : 
     885       14398 :         m_assumeutxo_data = MapAssumeutxo{
     886        7199 :             {
     887        7199 :                 110,
     888        7199 :                 {AssumeutxoHash{uint256S("0x9b2a277a3e3b979f1a539d57e949495d7f8247312dbc32bce6619128c192b44b")}, 110},
     889             :             },
     890        7199 :             {
     891        7199 :                 200,
     892        7199 :                 {AssumeutxoHash{uint256S("0x8a5bdd92252fc6b24663244bbe958c947bb036dc1f94ccd15439f48d8d1cb4e3")}, 200},
     893             :             },
     894             :         };
     895             : 
     896        7199 :         chainTxData = ChainTxData{
     897             :             0,
     898             :             0,
     899             :             0
     900             :         };
     901             : 
     902             :         // Regtest Dash addresses start with 'y'
     903        7199 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
     904             :         // Regtest Dash script addresses start with '8' or '9'
     905        7199 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
     906             :         // Regtest private keys start with '9' or 'c' (Bitcoin defaults)
     907        7199 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
     908             :         // Regtest Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
     909        7199 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
     910             :         // Regtest Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
     911        7199 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     912             : 
     913             :         // DIP-18 Dash Platform address HRP (bech32m)
     914        7199 :         bech32_platform_hrp = "tdash";
     915             : 
     916             :         // Regtest Dash BIP44 coin type is '1' (All coin's testnet default)
     917        7199 :         nExtCoinType = 1;
     918             : 
     919             :         // long living quorum params
     920        7199 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST);
     921        7199 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_INSTANTSEND);
     922        7199 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_V17);
     923        7199 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_DIP0024);
     924        7199 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_PLATFORM);
     925        7199 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_TEST;
     926        7199 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_TEST_DIP0024;
     927        7199 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_TEST_PLATFORM;
     928        7199 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_TEST;
     929             : 
     930        7199 :         UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST);
     931        7199 :         UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_INSTANTSEND);
     932        7199 :         UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_PLATFORM);
     933        7199 :         UpdateLLMQInstantSendDIP0024FromArgs(args);
     934             :         // V20 features for CbTx (credit pool, CL) have no meaning without masternodes
     935        7199 :         assert(consensus.V20Height >= consensus.DIP0003Height);
     936             :         // MN_RR reallocate part of reward to CreditPool which exits since V20
     937        7199 :         assert(consensus.MN_RRHeight >= consensus.V20Height);
     938       14422 :     }
     939             : 
     940             :     /**
     941             :      * Allows modifying the Version Bits regtest parameters.
     942             :      */
     943         306 :     void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int min_activation_height, int64_t nWindowSize, int64_t nThresholdStart, int64_t nThresholdMin, int64_t nFalloffCoeff, int64_t nUseEHF)
     944             :     {
     945         306 :         consensus.vDeployments[d].nStartTime = nStartTime;
     946         306 :         consensus.vDeployments[d].nTimeout = nTimeout;
     947         306 :         consensus.vDeployments[d].min_activation_height = min_activation_height;
     948         306 :         if (nWindowSize != -1) {
     949         274 :             consensus.vDeployments[d].nWindowSize = nWindowSize;
     950         274 :         }
     951         306 :         if (nThresholdStart != -1) {
     952         274 :             consensus.vDeployments[d].nThresholdStart = nThresholdStart;
     953         274 :         }
     954         306 :         if (nThresholdMin != -1) {
     955         274 :             consensus.vDeployments[d].nThresholdMin = nThresholdMin;
     956         274 :         }
     957         306 :         if (nFalloffCoeff != -1) {
     958         274 :             consensus.vDeployments[d].nFalloffCoeff = nFalloffCoeff;
     959         274 :         }
     960         306 :         if (nUseEHF != -1) {
     961          79 :             consensus.vDeployments[d].useEHF = nUseEHF > 0;
     962          79 :         }
     963         306 :     }
     964             :     void UpdateActivationParametersFromArgs(const ArgsManager& args);
     965             : 
     966             :     /**
     967             :      * Allows modifying the DIP3 activation and enforcement height
     968             :      */
     969         963 :     void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
     970             :     {
     971         963 :         consensus.DIP0003Height = nActivationHeight;
     972         963 :         consensus.DIP0003EnforcementHeight = nEnforcementHeight;
     973         963 :     }
     974             :     void UpdateDIP3ParametersFromArgs(const ArgsManager& args);
     975             : 
     976             :     /**
     977             :      * Allows modifying the budget regtest parameters.
     978             :      */
     979         128 :     void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
     980             :     {
     981         128 :         consensus.nMasternodePaymentsStartBlock = nMasternodePaymentsStartBlock;
     982         128 :         consensus.nBudgetPaymentsStartBlock = nBudgetPaymentsStartBlock;
     983         128 :         consensus.nSuperblockStartBlock = nSuperblockStartBlock;
     984         128 :     }
     985             :     void UpdateBudgetParametersFromArgs(const ArgsManager& args);
     986             : 
     987             :     /**
     988             :      * Allows modifying parameters of the test LLMQ
     989             :      */
     990        1107 :     void UpdateLLMQTestParameters(int size, int threshold, const Consensus::LLMQType llmqType)
     991             :     {
     992        4059 :         auto params = std::ranges::find_if(consensus.llmqs, [llmqType](const auto& llmq){ return llmq.type == llmqType;});
     993        1107 :         assert(params != consensus.llmqs.end());
     994        1107 :         params->size = size;
     995        1107 :         params->minSize = threshold;
     996        1107 :         params->threshold = threshold;
     997        1107 :         params->dkgBadVotesThreshold = threshold;
     998        1107 :     }
     999             : 
    1000             :     /**
    1001             :      * Allows modifying the LLMQ type for InstantSend (DIP0024).
    1002             :      */
    1003          29 :     void UpdateLLMQDIP0024InstantSend(Consensus::LLMQType llmqType)
    1004             :     {
    1005          29 :         consensus.llmqTypeDIP0024InstantSend = llmqType;
    1006          29 :     }
    1007             : 
    1008             :     void UpdateLLMQTestParametersFromArgs(const ArgsManager& args, const Consensus::LLMQType llmqType);
    1009             :     void UpdateLLMQInstantSendDIP0024FromArgs(const ArgsManager& args);
    1010             : };
    1011             : 
    1012        7211 : static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& consensus)
    1013             : {
    1014        9137 :     for (const std::string& arg : args.GetArgs("-testactivationheight")) {
    1015        1926 :         const auto found{arg.find('@')};
    1016        1926 :         if (found == std::string::npos) {
    1017           4 :             throw std::runtime_error(strprintf("Invalid format (%s) for -testactivationheight=name@height.", arg));
    1018             :         }
    1019        1922 :         const auto name{arg.substr(0, found)};
    1020        1922 :         const auto value{arg.substr(found + 1)};
    1021             :         int32_t height;
    1022        1922 :         if (!ParseInt32(value, &height) || height < 0 || height >= std::numeric_limits<int>::max()) {
    1023           4 :             throw std::runtime_error(strprintf("Invalid height value (%s) for -testactivationheight=name@height.", arg));
    1024             :         }
    1025        1918 :         if (name == "bip147") {
    1026           6 :             consensus.BIP147Height = int{height};
    1027        1918 :         } else if (name == "bip34") {
    1028           7 :             consensus.BIP34Height = int{height};
    1029        1912 :         } else if (name == "dersig") {
    1030           9 :             consensus.BIP66Height = int{height};
    1031        1905 :         } else if (name == "cltv") {
    1032           6 :             consensus.BIP65Height = int{height};
    1033        1896 :         } else if (name == "csv") {
    1034          12 :             consensus.CSVHeight = int{height};
    1035        1890 :         } else if (name == "brr") {
    1036           5 :             consensus.BRRHeight = int{height};
    1037        1878 :         } else if (name == "dip0001") {
    1038          17 :             consensus.DIP0001Height = int{height};
    1039        1873 :         } else if (name == "dip0008") {
    1040          14 :             consensus.DIP0008Height = int{height};
    1041        1856 :         } else if (name == "dip0024") {
    1042          14 :             consensus.DIP0024Height = int{height};
    1043          14 :             consensus.DIP0024QuorumsHeight = int{height};
    1044        1842 :         } else if (name == "v19") {
    1045          64 :             consensus.V19Height = int{height};
    1046        1828 :         } else if (name == "v20") {
    1047         880 :             consensus.V20Height = int{height};
    1048        1764 :         } else if (name == "mn_rr") {
    1049         880 :             consensus.MN_RRHeight = int{height};
    1050         880 :         } else {
    1051           4 :             throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
    1052             :         }
    1053        1922 :     }
    1054        7211 : }
    1055             : 
    1056        7199 : void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args)
    1057             : {
    1058        7199 :     MaybeUpdateHeights(args, consensus);
    1059             : 
    1060        7199 :     if (!args.IsArgSet("-vbparams")) return;
    1061             : 
    1062         612 :     for (const std::string& strDeployment : args.GetArgs("-vbparams")) {
    1063         306 :         std::vector<std::string> vDeploymentParams = SplitString(strDeployment, ':');
    1064         306 :         if (vDeploymentParams.size() != 3 && vDeploymentParams.size() != 4 && vDeploymentParams.size() != 6 && vDeploymentParams.size() != 9) {
    1065           0 :             throw std::runtime_error("Version bits parameters malformed, expecting "
    1066             :                     "<deployment>:<start>:<end> or "
    1067             :                     "<deployment>:<start>:<end>:<min_activation_height> or "
    1068             :                     "<deployment>:<start>:<end>:<min_activation_height>:<window>:<threshold> or "
    1069             :                     "<deployment>:<start>:<end>:<min_activation_height>:<window>:<thresholdstart>:<thresholdmin>:<falloffcoeff>:<useehf>");
    1070             :         }
    1071         306 :         int64_t nStartTime, nTimeout, nWindowSize = -1, nThresholdStart = -1, nThresholdMin = -1, nFalloffCoeff = -1, nUseEHF = -1;
    1072         306 :         int min_activation_height = 0;
    1073         306 :         if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
    1074           0 :             throw std::runtime_error(strprintf("Invalid nStartTime (%s)", vDeploymentParams[1]));
    1075             :         }
    1076         306 :         if (!ParseInt64(vDeploymentParams[2], &nTimeout)) {
    1077           0 :             throw std::runtime_error(strprintf("Invalid nTimeout (%s)", vDeploymentParams[2]));
    1078             :         }
    1079         306 :         if (vDeploymentParams.size() >= 4 && !ParseInt32(vDeploymentParams[3], &min_activation_height)) {
    1080           0 :             throw std::runtime_error(strprintf("Invalid min_activation_height (%s)", vDeploymentParams[3]));
    1081             :         }
    1082         306 :         if (vDeploymentParams.size() >= 6) {
    1083         274 :             if (!ParseInt64(vDeploymentParams[4], &nWindowSize)) {
    1084           0 :                 throw std::runtime_error(strprintf("Invalid nWindowSize (%s)", vDeploymentParams[4]));
    1085             :             }
    1086         274 :             if (!ParseInt64(vDeploymentParams[5], &nThresholdStart)) {
    1087           0 :                 throw std::runtime_error(strprintf("Invalid nThresholdStart (%s)", vDeploymentParams[5]));
    1088             :             }
    1089         274 :         }
    1090         306 :         if (vDeploymentParams.size() == 9) {
    1091         274 :             if (!ParseInt64(vDeploymentParams[6], &nThresholdMin)) {
    1092           0 :                 throw std::runtime_error(strprintf("Invalid nThresholdMin (%s)", vDeploymentParams[6]));
    1093             :             }
    1094         274 :             if (!ParseInt64(vDeploymentParams[7], &nFalloffCoeff)) {
    1095           0 :                 throw std::runtime_error(strprintf("Invalid nFalloffCoeff (%s)", vDeploymentParams[7]));
    1096             :             }
    1097         274 :             if (!ParseInt64(vDeploymentParams[8], &nUseEHF)) {
    1098           0 :                 throw std::runtime_error(strprintf("Invalid nUseEHF (%s)", vDeploymentParams[8]));
    1099             :             }
    1100         274 :         }
    1101         306 :         bool found = false;
    1102         324 :         for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
    1103         324 :             if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
    1104         306 :                 UpdateVersionBitsParameters(Consensus::DeploymentPos(j), nStartTime, nTimeout, min_activation_height, nWindowSize, nThresholdStart, nThresholdMin, nFalloffCoeff, nUseEHF);
    1105         306 :                 found = true;
    1106         306 :                 LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%ld, window=%ld, thresholdstart=%ld, thresholdmin=%ld, falloffcoeff=%ld, useehf=%ld\n",
    1107             :                           vDeploymentParams[0], nStartTime, nTimeout, min_activation_height, nWindowSize, nThresholdStart, nThresholdMin, nFalloffCoeff, nUseEHF);
    1108         306 :                 break;
    1109             :             }
    1110          18 :         }
    1111         306 :         if (!found) {
    1112           0 :             throw std::runtime_error(strprintf("Invalid deployment (%s)", vDeploymentParams[0]));
    1113             :         }
    1114         306 :     }
    1115        7199 : }
    1116             : 
    1117        7199 : void CRegTestParams::UpdateDIP3ParametersFromArgs(const ArgsManager& args)
    1118             : {
    1119        7199 :     if (!args.IsArgSet("-dip3params")) return;
    1120             : 
    1121         963 :     std::string strParams = args.GetArg("-dip3params", "");
    1122         963 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1123         963 :     if (vParams.size() != 2) {
    1124           0 :         throw std::runtime_error("DIP3 parameters malformed, expecting <activation>:<enforcement>");
    1125             :     }
    1126             :     int nDIP3ActivationHeight, nDIP3EnforcementHeight;
    1127         963 :     if (!ParseInt32(vParams[0], &nDIP3ActivationHeight)) {
    1128           0 :         throw std::runtime_error(strprintf("Invalid activation height (%s)", vParams[0]));
    1129             :     }
    1130         963 :     if (!ParseInt32(vParams[1], &nDIP3EnforcementHeight)) {
    1131           0 :         throw std::runtime_error(strprintf("Invalid enforcement height (%s)", vParams[1]));
    1132             :     }
    1133         963 :     LogPrintf("Setting DIP3 parameters to activation=%ld, enforcement=%ld\n", nDIP3ActivationHeight, nDIP3EnforcementHeight);
    1134         963 :     UpdateDIP3Parameters(nDIP3ActivationHeight, nDIP3EnforcementHeight);
    1135        7199 : }
    1136             : 
    1137        7199 : void CRegTestParams::UpdateBudgetParametersFromArgs(const ArgsManager& args)
    1138             : {
    1139        7199 :     if (!args.IsArgSet("-budgetparams")) return;
    1140             : 
    1141         128 :     std::string strParams = args.GetArg("-budgetparams", "");
    1142         128 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1143         128 :     if (vParams.size() != 3) {
    1144           0 :         throw std::runtime_error("Budget parameters malformed, expecting <masternode>:<budget>:<superblock>");
    1145             :     }
    1146             :     int nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock;
    1147         128 :     if (!ParseInt32(vParams[0], &nMasternodePaymentsStartBlock)) {
    1148           0 :         throw std::runtime_error(strprintf("Invalid masternode start height (%s)", vParams[0]));
    1149             :     }
    1150         128 :     if (!ParseInt32(vParams[1], &nBudgetPaymentsStartBlock)) {
    1151           0 :         throw std::runtime_error(strprintf("Invalid budget start block (%s)", vParams[1]));
    1152             :     }
    1153         128 :     if (!ParseInt32(vParams[2], &nSuperblockStartBlock)) {
    1154           0 :         throw std::runtime_error(strprintf("Invalid superblock start height (%s)", vParams[2]));
    1155             :     }
    1156         128 :     LogPrintf("Setting budget parameters to masternode=%ld, budget=%ld, superblock=%ld\n", nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
    1157         128 :     UpdateBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
    1158        7199 : }
    1159             : 
    1160       21597 : void CRegTestParams::UpdateLLMQTestParametersFromArgs(const ArgsManager& args, const Consensus::LLMQType llmqType)
    1161             : {
    1162       21597 :     assert(llmqType == Consensus::LLMQType::LLMQ_TEST || llmqType == Consensus::LLMQType::LLMQ_TEST_INSTANTSEND || llmqType == Consensus::LLMQType::LLMQ_TEST_PLATFORM);
    1163             : 
    1164       21597 :     std::string cmd_param{"-llmqtestparams"}, llmq_name{"LLMQ_TEST"};
    1165       21597 :     if (llmqType == Consensus::LLMQType::LLMQ_TEST_INSTANTSEND) {
    1166        7199 :         cmd_param = "-llmqtestinstantsendparams";
    1167        7199 :         llmq_name = "LLMQ_TEST_INSTANTSEND";
    1168        7199 :     }
    1169       21597 :     if (llmqType == Consensus::LLMQType::LLMQ_TEST_PLATFORM) {
    1170        7199 :         cmd_param = "-llmqtestplatformparams";
    1171        7199 :         llmq_name = "LLMQ_TEST_PLATFORM";
    1172        7199 :     }
    1173             : 
    1174       21597 :     if (!args.IsArgSet(cmd_param)) return;
    1175             : 
    1176        1107 :     std::string strParams = args.GetArg(cmd_param, "");
    1177        1107 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1178        1107 :     if (vParams.size() != 2) {
    1179           0 :         throw std::runtime_error(strprintf("%s parameters malformed, expecting <size>:<threshold>", llmq_name));
    1180             :     }
    1181             :     int size, threshold;
    1182        1107 :     if (!ParseInt32(vParams[0], &size)) {
    1183           0 :         throw std::runtime_error(strprintf("Invalid %s size (%s)", llmq_name, vParams[0]));
    1184             :     }
    1185        1107 :     if (!ParseInt32(vParams[1], &threshold)) {
    1186           0 :         throw std::runtime_error(strprintf("Invalid %s threshold (%s)", llmq_name, vParams[1]));
    1187             :     }
    1188        1107 :     LogPrintf("Setting %s parameters to size=%ld, threshold=%ld\n", llmq_name, size, threshold);
    1189        1107 :     UpdateLLMQTestParameters(size, threshold, llmqType);
    1190       21597 : }
    1191             : 
    1192        7199 : void CRegTestParams::UpdateLLMQInstantSendDIP0024FromArgs(const ArgsManager& args)
    1193             : {
    1194        7199 :     if (!args.IsArgSet("-llmqtestinstantsenddip0024")) return;
    1195             : 
    1196          29 :     const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeDIP0024InstantSend);
    1197          29 :     assert(llmq_params_opt.has_value());
    1198             : 
    1199          29 :     std::string strLLMQType = gArgs.GetArg("-llmqtestinstantsenddip0024", std::string(llmq_params_opt->name));
    1200             : 
    1201          29 :     Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
    1202         174 :     for (const auto& params : consensus.llmqs) {
    1203         145 :         if (params.name == strLLMQType) {
    1204          29 :             llmqType = params.type;
    1205          29 :         }
    1206             :     }
    1207          29 :     if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
    1208           0 :         throw std::runtime_error("Invalid LLMQ type specified for -llmqtestinstantsenddip0024.");
    1209             :     }
    1210          29 :     LogPrintf("Setting llmqtestinstantsenddip0024 to %ld\n", std23::to_underlying(llmqType));
    1211          29 :     UpdateLLMQDIP0024InstantSend(llmqType);
    1212        7199 : }
    1213             : 
    1214        3796 : void CDevNetParams::UpdateDevnetSubsidyAndDiffParametersFromArgs(const ArgsManager& args)
    1215             : {
    1216        3796 :     if (!args.IsArgSet("-minimumdifficultyblocks") && !args.IsArgSet("-highsubsidyblocks") && !args.IsArgSet("-highsubsidyfactor")) return;
    1217             : 
    1218           0 :     int nMinimumDifficultyBlocks = gArgs.GetIntArg("-minimumdifficultyblocks", consensus.nMinimumDifficultyBlocks);
    1219           0 :     int nHighSubsidyBlocks = gArgs.GetIntArg("-highsubsidyblocks", consensus.nHighSubsidyBlocks);
    1220           0 :     int nHighSubsidyFactor = gArgs.GetIntArg("-highsubsidyfactor", consensus.nHighSubsidyFactor);
    1221           0 :     LogPrintf("Setting minimumdifficultyblocks=%ld, highsubsidyblocks=%ld, highsubsidyfactor=%ld\n", nMinimumDifficultyBlocks, nHighSubsidyBlocks, nHighSubsidyFactor);
    1222           0 :     UpdateDevnetSubsidyAndDiffParameters(nMinimumDifficultyBlocks, nHighSubsidyBlocks, nHighSubsidyFactor);
    1223        3796 : }
    1224             : 
    1225        3796 : void CDevNetParams::UpdateDevnetLLMQChainLocksFromArgs(const ArgsManager& args)
    1226             : {
    1227        3796 :     if (!args.IsArgSet("-llmqchainlocks")) return;
    1228             : 
    1229           0 :     const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeChainLocks);
    1230           0 :     assert(llmq_params_opt.has_value());
    1231             : 
    1232           0 :     std::string strLLMQType = gArgs.GetArg("-llmqchainlocks", std::string(llmq_params_opt->name));
    1233             : 
    1234           0 :     Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
    1235           0 :     for (const auto& params : consensus.llmqs) {
    1236           0 :         if (params.name == strLLMQType) {
    1237           0 :             if (params.useRotation) {
    1238           0 :                 throw std::runtime_error("LLMQ type specified for -llmqchainlocks must NOT use rotation");
    1239             :             }
    1240           0 :             llmqType = params.type;
    1241           0 :         }
    1242             :     }
    1243           0 :     if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
    1244           0 :         throw std::runtime_error("Invalid LLMQ type specified for -llmqchainlocks.");
    1245             :     }
    1246           0 :     LogPrintf("Setting llmqchainlocks to size=%ld\n", static_cast<uint8_t>(llmqType));
    1247           0 :     UpdateDevnetLLMQChainLocks(llmqType);
    1248        3796 : }
    1249             : 
    1250        3796 : void CDevNetParams::UpdateDevnetLLMQInstantSendDIP0024FromArgs(const ArgsManager& args)
    1251             : {
    1252        3796 :     if (!args.IsArgSet("-llmqinstantsenddip0024")) return;
    1253             : 
    1254           0 :     const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeDIP0024InstantSend);
    1255           0 :     assert(llmq_params_opt.has_value());
    1256             : 
    1257           0 :     std::string strLLMQType = gArgs.GetArg("-llmqinstantsenddip0024", std::string(llmq_params_opt->name));
    1258             : 
    1259           0 :     Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
    1260           0 :     for (const auto& params : consensus.llmqs) {
    1261           0 :         if (params.name == strLLMQType) {
    1262           0 :             if (!params.useRotation) {
    1263           0 :                 throw std::runtime_error("LLMQ type specified for -llmqinstantsenddip0024 must use rotation");
    1264             :             }
    1265           0 :             llmqType = params.type;
    1266           0 :         }
    1267             :     }
    1268           0 :     if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
    1269           0 :         throw std::runtime_error("Invalid LLMQ type specified for -llmqinstantsenddip0024.");
    1270             :     }
    1271           0 :     LogPrintf("Setting llmqinstantsenddip0024 to size=%ld\n", static_cast<uint8_t>(llmqType));
    1272           0 :     UpdateDevnetLLMQDIP0024InstantSend(llmqType);
    1273        3796 : }
    1274             : 
    1275        3796 : void CDevNetParams::UpdateDevnetLLMQPlatformFromArgs(const ArgsManager& args)
    1276             : {
    1277        3796 :     if (!args.IsArgSet("-llmqplatform")) return;
    1278             : 
    1279           0 :     const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypePlatform);
    1280           0 :     assert(llmq_params_opt.has_value());
    1281             : 
    1282           0 :     std::string strLLMQType = gArgs.GetArg("-llmqplatform", std::string(llmq_params_opt->name));
    1283             : 
    1284           0 :     Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
    1285           0 :     for (const auto& params : consensus.llmqs) {
    1286           0 :         if (params.name == strLLMQType) {
    1287           0 :             llmqType = params.type;
    1288           0 :         }
    1289             :     }
    1290           0 :     if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
    1291           0 :         throw std::runtime_error("Invalid LLMQ type specified for -llmqplatform.");
    1292             :     }
    1293           0 :     LogPrintf("Setting llmqplatform to size=%ld\n", static_cast<uint8_t>(llmqType));
    1294           0 :     UpdateDevnetLLMQPlatform(llmqType);
    1295        3796 : }
    1296             : 
    1297        3796 : void CDevNetParams::UpdateDevnetLLMQMnhfFromArgs(const ArgsManager& args)
    1298             : {
    1299        3796 :     if (!args.IsArgSet("-llmqmnhf")) return;
    1300             : 
    1301           0 :     const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeMnhf);
    1302           0 :     assert(llmq_params_opt.has_value());
    1303             : 
    1304           0 :     std::string strLLMQType = gArgs.GetArg("-llmqmnhf", std::string(llmq_params_opt->name));
    1305             : 
    1306           0 :     Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
    1307           0 :     for (const auto& params : consensus.llmqs) {
    1308           0 :         if (params.name == strLLMQType) {
    1309           0 :             llmqType = params.type;
    1310           0 :         }
    1311             :     }
    1312           0 :     if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
    1313           0 :         throw std::runtime_error("Invalid LLMQ type specified for -llmqmnhf.");
    1314             :     }
    1315           0 :     LogPrintf("Setting llmqmnhf to size=%ld\n", static_cast<uint8_t>(llmqType));
    1316           0 :     UpdateDevnetLLMQMnhf(llmqType);
    1317        3796 : }
    1318             : 
    1319        3796 : void CDevNetParams::UpdateDevnetPowTargetSpacingFromArgs(const ArgsManager& args)
    1320             : {
    1321        3796 :     if (!args.IsArgSet("-powtargetspacing")) return;
    1322             : 
    1323           0 :     std::string strPowTargetSpacing = gArgs.GetArg("-powtargetspacing", "");
    1324             : 
    1325             :     int64_t powTargetSpacing;
    1326           0 :     if (!ParseInt64(strPowTargetSpacing, &powTargetSpacing)) {
    1327           0 :         throw std::runtime_error(strprintf("Invalid parsing of powTargetSpacing (%s)", strPowTargetSpacing));
    1328             :     }
    1329             : 
    1330           0 :     if (powTargetSpacing < 1) {
    1331           0 :         throw std::runtime_error(strprintf("Invalid value of powTargetSpacing (%s)", strPowTargetSpacing));
    1332             :     }
    1333             : 
    1334           0 :     LogPrintf("Setting powTargetSpacing to %ld\n", powTargetSpacing);
    1335           0 :     UpdateDevnetPowTargetSpacing(powTargetSpacing);
    1336        3796 : }
    1337             : 
    1338        3796 : void CDevNetParams::UpdateLLMQDevnetParametersFromArgs(const ArgsManager& args)
    1339             : {
    1340        3796 :     if (!args.IsArgSet("-llmqdevnetparams")) return;
    1341             : 
    1342           0 :     std::string strParams = args.GetArg("-llmqdevnetparams", "");
    1343           0 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1344           0 :     if (vParams.size() != 2) {
    1345           0 :         throw std::runtime_error("LLMQ_DEVNET parameters malformed, expecting <size>:<threshold>");
    1346             :     }
    1347             :     int size, threshold;
    1348           0 :     if (!ParseInt32(vParams[0], &size)) {
    1349           0 :         throw std::runtime_error(strprintf("Invalid LLMQ_DEVNET size (%s)", vParams[0]));
    1350             :     }
    1351           0 :     if (!ParseInt32(vParams[1], &threshold)) {
    1352           0 :         throw std::runtime_error(strprintf("Invalid LLMQ_DEVNET threshold (%s)", vParams[1]));
    1353             :     }
    1354           0 :     LogPrintf("Setting LLMQ_DEVNET parameters to size=%ld, threshold=%ld\n", size, threshold);
    1355           0 :     UpdateLLMQDevnetParameters(size, threshold);
    1356        3796 : }
    1357             : 
    1358             : static std::unique_ptr<const CChainParams> globalChainParams;
    1359             : 
    1360    26255955 : const CChainParams &Params() {
    1361    26255955 :     assert(globalChainParams);
    1362    26255955 :     return *globalChainParams;
    1363             : }
    1364             : 
    1365       20016 : std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, const std::string& chain)
    1366             : {
    1367       20016 :     if (chain == CBaseChainParams::MAIN) {
    1368        5133 :         return std::unique_ptr<CChainParams>(new CMainParams());
    1369       14895 :     } else if (chain == CBaseChainParams::TESTNET) {
    1370        3888 :         return std::unique_ptr<CChainParams>(new CTestNetParams());
    1371       11007 :     } else if (chain == CBaseChainParams::DEVNET) {
    1372        3796 :         return std::unique_ptr<CChainParams>(new CDevNetParams(args));
    1373        7211 :     } else if (chain == CBaseChainParams::REGTEST) {
    1374        7211 :         return std::unique_ptr<CChainParams>(new CRegTestParams(args));
    1375             :     }
    1376           0 :     throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
    1377       20016 : }
    1378             : 
    1379        4217 : void SelectParams(const std::string& network)
    1380             : {
    1381        4217 :     SelectBaseParams(network);
    1382        4217 :     globalChainParams = CreateChainParams(gArgs, network);
    1383        4217 : }
    1384             : 
    1385        3789 : void SetupChainParamsOptions(ArgsManager& argsman)
    1386             : {
    1387        3789 :     SetupChainParamsBaseOptions(argsman);
    1388             : 
    1389        3789 :     argsman.AddArg("-budgetparams=<masternode>:<budget>:<superblock>", "Override masternode, budget and superblock start heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1390        3789 :     argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1391        3789 :     argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1392        3789 :     argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1393        3789 :     argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1394        3789 :     argsman.AddArg("-llmqdevnetparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_DEVNET quorum (devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1395        3789 :     argsman.AddArg("-llmqinstantsenddip0024=<quorum name>", "Override the default LLMQ type used for InstantSendDIP0024. (default: llmq_devnet_dip0024, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1396        3789 :     argsman.AddArg("-llmqplatform=<quorum name>", "Override the default LLMQ type used for Platform. (default: llmq_devnet_platform, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1397        3789 :     argsman.AddArg("-llmqmnhf=<quorum name>", "Override the default LLMQ type used for EHF. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1398        3789 :     argsman.AddArg("-llmqtestinstantsenddip0024=<quorum name>", "Override the default LLMQ type used for InstantSendDIP0024. Used mainly to test Platform. (default: llmq_test_dip0024, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1399        3789 :     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);
    1400        3789 :     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);
    1401        3789 :     argsman.AddArg("-llmqtestplatformparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST_PLATFORM quorum (default: 3:2, regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1402        3789 :     argsman.AddArg("-minimumdifficultyblocks=<n>", "The number of blocks that can be mined with the minimum difficulty at the start of a chain (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1403        3789 :     argsman.AddArg("-powtargetspacing=<n>", "Override the default PowTargetSpacing value in seconds (default: 2.5 minutes, devnet-only)", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::CHAINPARAMS);
    1404        3789 :     argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, dip0024, v19, v20, mn_rr). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1405        3789 :     argsman.AddArg("-vbparams=<deployment>:<start>:<end>(:min_activation_height(:<window>:<threshold/thresholdstart>(:<thresholdmin>:<falloffcoeff>:<mnactivation>)))",
    1406        3789 :                  "Use given start/end times and min_activation_height for specified version bits deployment (regtest-only). "
    1407        3789 :                  "Specifying window, threshold/thresholdstart, thresholdmin, falloffcoeff and mnactivation is optional.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1408        3789 : }

Generated by: LCOV version 1.16