LCOV - code coverage report
Current view: top level - src - chainparams.cpp (source / functions) Hit Total Coverage
Test: test_dash_coverage.info Lines: 785 970 80.9 %
Date: 2026-06-25 07:23:51 Functions: 34 46 73.9 %

          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        3502 : 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        3502 :     CMutableTransaction txNew;
      25        3502 :     txNew.nVersion = 1;
      26        3502 :     txNew.vin.resize(1);
      27        3502 :     txNew.vout.resize(1);
      28        3502 :     txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
      29        3502 :     txNew.vout[0].nValue = genesisReward;
      30        3502 :     txNew.vout[0].scriptPubKey = genesisOutputScript;
      31             : 
      32        3502 :     CBlock genesis;
      33        3502 :     genesis.nTime    = nTime;
      34        3502 :     genesis.nBits    = nBits;
      35        3502 :     genesis.nNonce   = nNonce;
      36        3502 :     genesis.nVersion = nVersion;
      37        3502 :     genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
      38        3502 :     genesis.hashPrevBlock.SetNull();
      39        3502 :     genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
      40        3502 :     return genesis;
      41        3502 : }
      42             : 
      43         630 : static CBlock CreateDevNetGenesisBlock(const uint256 &prevBlockHash, const std::string& devNetName, uint32_t nTime, uint32_t nNonce, uint32_t nBits, const CAmount& genesisReward)
      44             : {
      45         630 :     assert(!devNetName.empty());
      46             : 
      47         630 :     CMutableTransaction txNew;
      48         630 :     txNew.nVersion = 1;
      49         630 :     txNew.vin.resize(1);
      50         630 :     txNew.vout.resize(1);
      51             :     // put height (BIP34) and devnet name into coinbase
      52         630 :     txNew.vin[0].scriptSig = CScript() << 1 << std::vector<unsigned char>(devNetName.begin(), devNetName.end());
      53         630 :     txNew.vout[0].nValue = genesisReward;
      54         630 :     txNew.vout[0].scriptPubKey = CScript() << OP_RETURN;
      55             : 
      56         630 :     CBlock genesis;
      57         630 :     genesis.nTime    = nTime;
      58         630 :     genesis.nBits    = nBits;
      59         630 :     genesis.nNonce   = nNonce;
      60         630 :     genesis.nVersion = 4;
      61         630 :     genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
      62         630 :     genesis.hashPrevBlock = prevBlockHash;
      63         630 :     genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
      64         630 :     return genesis;
      65         630 : }
      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        3502 : static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
      79             : {
      80        3502 :     const char* pszTimestamp = "Wired 09/Jan/2014 The Grand Experiment Goes Live: Overstock.com Is Now Accepting Bitcoins";
      81        3502 :     const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG;
      82        3502 :     return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
      83        3502 : }
      84             : 
      85         630 : static CBlock FindDevNetGenesisBlock(const CBlock &prevBlock, const CAmount& reward)
      86             : {
      87         630 :     std::string devNetName = gArgs.GetDevNetName();
      88         630 :     assert(!devNetName.empty());
      89             : 
      90         630 :     CBlock block = CreateDevNetGenesisBlock(prevBlock.GetHash(), devNetName, prevBlock.nTime + 1, 0, prevBlock.nBits, reward);
      91             : 
      92         630 :     arith_uint256 bnTarget;
      93         630 :     bnTarget.SetCompact(block.nBits);
      94             : 
      95         631 :     for (uint32_t nNonce = 0; nNonce < UINT32_MAX; nNonce++) {
      96         631 :         block.nNonce = nNonce;
      97             : 
      98         631 :         uint256 hash = block.GetHash();
      99         631 :         if (UintToArith256(hash) <= bnTarget)
     100         630 :             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         630 : }
     108             : 
     109           2 : bool CChainParams::IsValidMNActivation(int nBit, int64_t timePast) const
     110             : {
     111           2 :     assert(nBit < VERSIONBITS_NUM_BITS);
     112             : 
     113           4 :     for (int index = 0; index < Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++index) {
     114           3 :         if (consensus.vDeployments[index].bit == nBit) {
     115           1 :             auto& deployment = consensus.vDeployments[index];
     116           1 :             if (timePast > deployment.nTimeout || timePast < deployment.nStartTime) {
     117           0 :                 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           0 :                 continue;
     119             :             }
     120           1 :             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           0 :             LogPrintf("%s: set MnEHF for bit=%d is valid\n", __func__, nBit);
     125           0 :             return true;
     126             :         }
     127           2 :     }
     128           1 :     LogPrintf("%s: WARNING: unknown MnEHF fork bit=%d\n", __func__, nBit);
     129           1 :     return true;
     130           2 : }
     131             : 
     132       20116 : void CChainParams::AddLLMQ(Consensus::LLMQType llmqType)
     133             : {
     134       20116 :     assert(!GetLLMQ(llmqType).has_value());
     135      183264 :     for (const auto& llmq_param : Consensus::available_llmqs) {
     136      183264 :         if (llmq_param.type == llmqType) {
     137       20116 :             consensus.llmqs.push_back(llmq_param);
     138       20116 :             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      384985 : std::optional<Consensus::LLMQParams> CChainParams::GetLLMQ(Consensus::LLMQType llmqType) const
     146             : {
     147     1269836 :     for (const auto& llmq_param : consensus.llmqs) {
     148     1249720 :         if (llmq_param.type == llmqType) {
     149      364869 :             return std::make_optional(llmq_param);
     150             :         }
     151             :     }
     152       20116 :     return std::nullopt;
     153      384985 : }
     154             : 
     155             : /**
     156             :  * Main network on which people trade goods and services.
     157             :  */
     158             : class CMainParams : public CChainParams {
     159             : public:
     160        2682 :     CMainParams() {
     161        1341 :         strNetworkID = CBaseChainParams::MAIN;
     162        1341 :         consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050)
     163        1341 :         consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
     164        1341 :         consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value
     165        1341 :         consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value
     166        1341 :         consensus.nInstantSendConfirmationsRequired = 6;
     167        1341 :         consensus.nInstantSendKeepLock = 24;
     168        1341 :         consensus.nBudgetPaymentsStartBlock = 328008; // actual historical value
     169        1341 :         consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
     170        1341 :         consensus.nBudgetPaymentsWindowBlocks = 100;
     171        1341 :         consensus.nSuperblockStartBlock = 614820; // The block at which 12.1 goes live (end of final 12.0 budget cycle)
     172        1341 :         consensus.nSuperblockStartHash = uint256S("0000000000020cb27c7ef164d21003d5d20cdca2f54dd9a9ca6d45f4d47f8aa3");
     173        1341 :         consensus.nSuperblockCycle = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725
     174        1341 :         consensus.nSuperblockMaturityWindow = 1662; // ~(60*24*3)/2.6, ~3 days before actual Superblock is emitted
     175        1341 :         consensus.nGovernanceMinQuorum = 10;
     176        1341 :         consensus.nGovernanceFilterElements = 20000;
     177        1341 :         consensus.nMasternodeMinimumConfirmations = 15;
     178        1341 :         consensus.BIP34Height = 951;
     179        1341 :         consensus.BIP34Hash = uint256S("0x000001f35e70f7c5705f64c6c5cc3dea9449e74d5b5c7cf74dad1bcca14a8012");
     180        1341 :         consensus.BIP65Height = 619382; // 00000000000076d8fcea02ec0963de4abfd01e771fec0863f960c2c64fe6f357
     181        1341 :         consensus.BIP66Height = 245817; // 00000000000b1fa2dfa312863570e13fae9ca7b5566cb27e55422620b469aefa
     182        1341 :         consensus.BIP147Height = 939456; // 00000000000000117befca4fab5622514772f608852e5edd8df9c55464b6fe37
     183        1341 :         consensus.CSVHeight = 622944; // 00000000000002e3d3a6224cfce80bae367fd3283d1e5a8ba50e5e60b2d2905d
     184        1341 :         consensus.DIP0001Height = 782208; // 000000000000000cbc9cb551e8ee1ac7aa223585cbdfb755d3683bafd93679e4
     185        1341 :         consensus.DIP0003Height = 1028160;
     186        1341 :         consensus.DIP0003EnforcementHeight = 1047200;
     187        1341 :         consensus.DIP0003EnforcementHash = uint256S("000000000000002d1734087b4c5afc3133e4e1c3e1a89218f62bcd9bb3d17f81");
     188        1341 :         consensus.DIP0008Height = 1088640; // 00000000000000112e41e4b3afda8b233b8cc07c532d2eac5de097b68358c43e
     189        1341 :         consensus.BRRHeight = 1374912; // 000000000000000c5a124f3eccfbe6e17876dca79cec9e63dfa70d269113c926
     190        1341 :         consensus.DIP0020Height = 1516032; // 000000000000000f64ed3bd9af1078177ac026f6aa2677aa4d8beeae43be56cc
     191        1341 :         consensus.DIP0024Height = 1737792; // 0000000000000001342be9c0b75ad40c276beaad91616423c4d9cb101b3db438
     192        1341 :         consensus.DIP0024QuorumsHeight = 1738698; // 000000000000001aa25181e4c466e593992c98f9eb21c69ee757b8bb0af50244
     193        1341 :         consensus.V19Height = 1899072; // 0000000000000015e32e73052d663626327004c81c5c22cb8b42c361015c0eae
     194        1341 :         consensus.V20Height = 1987776; // 000000000000001bf41cff06b76780050682ca29e61a91c391893d4745579777
     195        1341 :         consensus.MN_RRHeight = 2128896; // 0000000000000009a9696da93d3807eb14eb00a4ff449206d689156a21b27f26
     196        1341 :         consensus.WithdrawalsHeight = 2201472; // 00000000000000210518749e17c00b035a2a4982c906236c28c41ea2231bf7ef
     197        1341 :         consensus.MinBIP9WarningHeight = 2201472 + 2016; // withdrawals activation height + miner confirmation window
     198        1341 :         consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
     199        1341 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     200        1341 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     201        1341 :         consensus.fPowAllowMinDifficultyBlocks = false;
     202        1341 :         consensus.fPowNoRetargeting = false;
     203        1341 :         consensus.nPowKGWHeight = 15200;
     204        1341 :         consensus.nPowDGWHeight = 34140;
     205        1341 :         consensus.nRuleChangeActivationThreshold = 1815; // 90% of 2016
     206        1341 :         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
     207        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     208        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
     209        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     210        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     211             : 
     212        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     213        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE; // TODO
     214        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT; // TODO
     215        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 4032;
     216        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 3226;     // 80% of 4032
     217        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 2420;       // 60% of 4032
     218        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;          // this corresponds to 10 periods
     219        1341 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     220             : 
     221        1341 :         consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000b9040746437784aaec47"); // 2471728
     222        1341 :         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        1341 :         pchMessageStart[0] = 0xbf;
     230        1341 :         pchMessageStart[1] = 0x0c;
     231        1341 :         pchMessageStart[2] = 0x6b;
     232        1341 :         pchMessageStart[3] = 0xbd;
     233        1341 :         nDefaultPort = 9999;
     234        1341 :         nDefaultPlatformP2PPort = 26656;
     235        1341 :         nDefaultPlatformHTTPPort = 443;
     236        1341 :         nPruneAfterHeight = 100000;
     237        1341 :         m_assumed_blockchain_size = 57;
     238        1341 :         m_assumed_chain_state_size = 1;
     239             : 
     240        1341 :         genesis = CreateGenesisBlock(1390095618, 28917698, 0x1e0ffff0, 1, 50 * COIN);
     241        1341 :         consensus.hashGenesisBlock = genesis.GetHash();
     242        1341 :         assert(consensus.hashGenesisBlock == uint256S("0x00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6"));
     243        1341 :         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        1341 :         vSeeds.emplace_back("dnsseed.dash.org.");
     251             : 
     252             :         // Dash addresses start with 'X'
     253        1341 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,76);
     254             :         // Dash script addresses start with '7'
     255        1341 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,16);
     256             :         // Dash private keys start with '7' or 'X'
     257        1341 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,204);
     258             :         // Dash BIP32 pubkeys start with 'xpub' (Bitcoin defaults)
     259        1341 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
     260             :         // Dash BIP32 prvkeys start with 'xprv' (Bitcoin defaults)
     261        1341 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
     262             : 
     263             :         // DIP-18 Dash Platform address HRP (bech32m)
     264        1341 :         bech32_platform_hrp = "dash";
     265             : 
     266             :         // Dash BIP44 coin type is '5'
     267        1341 :         nExtCoinType = 5;
     268             : 
     269        1341 :         vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));
     270             : 
     271             :         // long living quorum params
     272        1341 :         AddLLMQ(Consensus::LLMQType::LLMQ_50_60);
     273        1341 :         AddLLMQ(Consensus::LLMQType::LLMQ_60_75);
     274        1341 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_60);
     275        1341 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_85);
     276        1341 :         AddLLMQ(Consensus::LLMQType::LLMQ_100_67);
     277        1341 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_400_60;
     278        1341 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_60_75;
     279        1341 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_100_67;
     280        1341 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_400_85;
     281             : 
     282        1341 :         fDefaultConsistencyChecks = false;
     283        1341 :         fRequireStandard = true;
     284        1341 :         fRequireRoutableExternalIP = true;
     285        1341 :         m_is_test_chain = false;
     286        1341 :         fAllowMultipleAddressesFromGroup = false;
     287        1341 :         nLLMQConnectionRetryTimeout = 60;
     288        1341 :         m_is_mockable_chain = false;
     289             : 
     290        1341 :         nPoolMinParticipants = 3;
     291        1341 :         nPoolMaxParticipants = 20;
     292        1341 :         nFulfilledRequestExpireTime = 60*60; // fulfilled requests expire in 1 hour
     293             : 
     294        1341 :         vSporkAddresses = {"Xgtyuk76vhuFW2iT7UAiHgNdWXCf3J34wh"};
     295        1341 :         nMinSporkKeys = 1;
     296             : 
     297        1341 :         nCreditPoolPeriodBlocks = 576;
     298             : 
     299        2682 :         checkpointData = {
     300        1341 :             {
     301        1341 :                 {1500, uint256S("0x000000aaf0300f59f49bc3e970bad15c11f961fe2347accffff19d96ec9778e3")},
     302        1341 :                 {4991, uint256S("0x000000003b01809551952460744d5dbb8fcbd6cbae3c220267bf7fa43f837367")},
     303        1341 :                 {9918, uint256S("0x00000000213e229f332c0ffbe34defdaa9e74de87f2d8d1f01af8d121c3c170b")},
     304        1341 :                 {16912, uint256S("0x00000000075c0d10371d55a60634da70f197548dbbfa4123e12abfcbc5738af9")},
     305        1341 :                 {23912, uint256S("0x0000000000335eac6703f3b1732ec8b2f89c3ba3a7889e5767b090556bb9a276")},
     306        1341 :                 {35457, uint256S("0x0000000000b0ae211be59b048df14820475ad0dd53b9ff83b010f71a77342d9f")},
     307        1341 :                 {45479, uint256S("0x000000000063d411655d590590e16960f15ceea4257122ac430c6fbe39fbf02d")},
     308        1341 :                 {55895, uint256S("0x0000000000ae4c53a43639a4ca027282f69da9c67ba951768a20415b6439a2d7")},
     309        1341 :                 {68899, uint256S("0x0000000000194ab4d3d9eeb1f2f792f21bb39ff767cb547fe977640f969d77b7")},
     310        1341 :                 {74619, uint256S("0x000000000011d28f38f05d01650a502cc3f4d0e793fbc26e2a2ca71f07dc3842")},
     311        1341 :                 {75095, uint256S("0x0000000000193d12f6ad352a9996ee58ef8bdc4946818a5fec5ce99c11b87f0d")},
     312        1341 :                 {88805, uint256S("0x00000000001392f1652e9bf45cd8bc79dc60fe935277cd11538565b4a94fa85f")},
     313        1341 :                 {107996, uint256S("0x00000000000a23840ac16115407488267aa3da2b9bc843e301185b7d17e4dc40")},
     314        1341 :                 {137993, uint256S("0x00000000000cf69ce152b1bffdeddc59188d7a80879210d6e5c9503011929c3c")},
     315        1341 :                 {167996, uint256S("0x000000000009486020a80f7f2cc065342b0c2fb59af5e090cd813dba68ab0fed")},
     316        1341 :                 {207992, uint256S("0x00000000000d85c22be098f74576ef00b7aa00c05777e966aff68a270f1e01a5")},
     317        1341 :                 {312645, uint256S("0x0000000000059dcb71ad35a9e40526c44e7aae6c99169a9e7017b7d84b1c2daf")},
     318        1341 :                 {407452, uint256S("0x000000000003c6a87e73623b9d70af7cd908ae22fee466063e4ffc20be1d2dbc")},
     319        1341 :                 {523412, uint256S("0x000000000000e54f036576a10597e0e42cc22a5159ce572f999c33975e121d4d")},
     320        1341 :                 {523930, uint256S("0x0000000000000bccdb11c2b1cfb0ecab452abf267d89b7f46eaf2d54ce6e652c")},
     321        1341 :                 {750000, uint256S("0x00000000000000b4181bbbdddbae464ce11fede5d0292fb63fdede1e7c8ab21c")},
     322        1341 :                 {888900, uint256S("0x0000000000000026c29d576073ab51ebd1d3c938de02e9a44c7ee9e16f82db28")},
     323        1341 :                 {967800, uint256S("0x0000000000000024e26c7df7e46d673724d223cf4ca2b2adc21297cc095600f4")},
     324        1341 :                 {1067570, uint256S("0x000000000000001e09926bcf5fa4513d23e870a34f74e38200db99eb3f5b7a70")},
     325        1341 :                 {1167570, uint256S("0x000000000000000fb7b1e9b81700283dff0f7d87cf458e5edfdae00c669de661")},
     326        1341 :                 {1364585, uint256S("0x00000000000000022f355c52417fca9b73306958f7c0832b3a7bce006ca369ef")},
     327        1341 :                 {1450000, uint256S("0x00000000000000105cfae44a995332d8ec256850ea33a1f7b700474e3dad82bc")},
     328        1341 :                 {1796500, uint256S("0x000000000000001d531f36005159f19351bd49ca676398a561e55dcccb84eacd")},
     329        1341 :                 {1850400, uint256S("0x00000000000000261bdbe99c01fcba992e577efa6cc41aae564b8ca9f112b2a3")},
     330        1341 :                 {1889000, uint256S("0x00000000000000075300e852d5bf5380f905b2768241f8b442498442084807a7")},
     331        1341 :                 {1969000, uint256S("0x000000000000000c8b7a3bdcd8b9f516462122314529c8342244c685a4c899bf")},
     332        1341 :                 {2029000, uint256S("0x0000000000000020d5e38b6aef5bc8e430029444d7977b46f710c7d281ef1281")},
     333        1341 :                 {2109672, uint256S("0x000000000000001889bd33ef019065e250d32bd46911f4003d3fdd8128b5358d")},
     334        1341 :                 {2175051, uint256S("0x000000000000001cf26547602d982dcaa909231bbcd1e70c0eb3c65de25473ba")},
     335        1341 :                 {2216986, uint256S("0x0000000000000010b1135dc743f27f6fc8a138c6420a9d963fc676f96c2048f4")},
     336        1341 :                 {2361500, uint256S("0x0000000000000009ba1e8f47851d036bb618a4f6565eb3c32d1f647d450ff195")},
     337        1341 :                 {2421800, uint256S("0x000000000000000718ed026ebd644a8b70b42d4cbd7b25304c066c9bf15f85b7")},
     338        1341 :                 {2471728, uint256S("0x000000000000001a19ad7270422a00f86123ea94e0b295a3a796d6861bd7b032")},
     339             :             }
     340             :         };
     341             : 
     342        1341 :         m_assumeutxo_data = MapAssumeutxo{
     343             :          // TODO to be specified in a future patch.
     344             :         };
     345             : 
     346             :         // getchaintxstats 17280 000000000000001a19ad7270422a00f86123ea94e0b295a3a796d6861bd7b032
     347        1341 :         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        2682 :     }
     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        1432 :     CTestNetParams() {
     362         716 :         strNetworkID = CBaseChainParams::TESTNET;
     363         716 :         consensus.nSubsidyHalvingInterval = 210240;
     364         716 :         consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
     365         716 :         consensus.nMasternodePaymentsIncreaseBlock = 4030;
     366         716 :         consensus.nMasternodePaymentsIncreasePeriod = 10;
     367         716 :         consensus.nInstantSendConfirmationsRequired = 2;
     368         716 :         consensus.nInstantSendKeepLock = 6;
     369         716 :         consensus.nBudgetPaymentsStartBlock = 4100;
     370         716 :         consensus.nBudgetPaymentsCycleBlocks = 50;
     371         716 :         consensus.nBudgetPaymentsWindowBlocks = 10;
     372         716 :         consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
     373         716 :         consensus.nSuperblockStartHash = uint256(); // do not check this on testnet
     374         716 :         consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on testnet
     375         716 :         consensus.nSuperblockMaturityWindow = 8;
     376         716 :         consensus.nGovernanceMinQuorum = 1;
     377         716 :         consensus.nGovernanceFilterElements = 500;
     378         716 :         consensus.nMasternodeMinimumConfirmations = 1;
     379         716 :         consensus.BIP34Height = 76;
     380         716 :         consensus.BIP34Hash = uint256S("0x000008ebb1db2598e897d17275285767717c6acfeac4c73def49fbea1ddcbcb6");
     381         716 :         consensus.BIP65Height = 2431; // 0000039cf01242c7f921dcb4806a5994bc003b48c1973ae0c89b67809c2bb2ab
     382         716 :         consensus.BIP66Height = 2075; // 0000002acdd29a14583540cb72e1c5cc83783560e38fa7081495d474fe1671f7
     383         716 :         consensus.BIP147Height = 4300; // 0000000040c1480d413c9203664253ab18da284130c329bf88fcfc84312bcbe0
     384         716 :         consensus.CSVHeight = 8064; // 00000005eb94d027e34649373669191188858a22c70f4a6d29105e559124cec7
     385         716 :         consensus.DIP0001Height = 5500; // 00000001d60a01d8f1f39011cc6b26e3a1c97a24238cab856c2da71a4dd801a9
     386         716 :         consensus.DIP0003Height = 7000;
     387         716 :         consensus.DIP0003EnforcementHeight = 7300;
     388         716 :         consensus.DIP0003EnforcementHash = uint256S("00000055ebc0e974ba3a3fb785c5ad4365a39637d4df168169ee80d313612f8f");
     389         716 :         consensus.DIP0008Height = 78800; // 000000000e9329d964d80e7dab2e704b43b6bd2b91fea1e9315d38932e55fb55
     390         716 :         consensus.BRRHeight = 387500; // 0000001537dbfd09dea69f61c1f8b2afa27c8dc91c934e144797761c9f10367b
     391         716 :         consensus.DIP0020Height = 414100; // 000000cf961868662fbfbb5d1af6f1caa1809f6a4e390efe5f8cd3031adea668
     392         716 :         consensus.DIP0024Height = 769700; // 0000008d84e4efd890ae95c70a7a6126a70a80e5c19e4cb264a5b3469aeef172
     393         716 :         consensus.DIP0024QuorumsHeight = 770730; // 0000003c43b3ae7fffe61278ca5537a0e256ebf4d709d45f0ab040271074d51e
     394         716 :         consensus.V19Height = 850100; // 000004728b8ff2a16b9d4eebb0fd61eeffadc9c7fe4b0ec0b5a739869401ab5b
     395         716 :         consensus.V20Height = 905100; // 0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd
     396         716 :         consensus.MN_RRHeight = 1066900; // 000000d05d445958a9a4ad6bdc0f4bfb25af124b2326060703373ff2d3b397e9
     397         716 :         consensus.WithdrawalsHeight = 1148500; // 000000212a6fec2ee2af040c6d7a176360b154cbaa998888170cfd9ae7dd632d
     398         716 :         consensus.MinBIP9WarningHeight = 1148500 + 2016;  // withdrawals activation height + miner confirmation window
     399         716 :         consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 20
     400         716 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     401         716 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     402         716 :         consensus.fPowAllowMinDifficultyBlocks = true;
     403         716 :         consensus.fPowNoRetargeting = false;
     404         716 :         consensus.nPowKGWHeight = 4002; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
     405         716 :         consensus.nPowDGWHeight = 4002; // TODO: make sure to drop all spork6 related code on next testnet reset
     406         716 :         consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
     407         716 :         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
     408         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     409         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
     410         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     411         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     412             : 
     413         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     414         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE; // TODO
     415         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     416         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 100;
     417         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 80;       // 80% of 100
     418         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 60;         // 60% of 100
     419         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;          // this corresponds to 10 periods
     420         716 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     421             : 
     422         716 :         consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000036c8f738da818d2"); // 1400000
     423         716 :         consensus.defaultAssumeValid = uint256S("0x000000541a23f9db7411cddbe50f9f1ebd4aa7108ebdcad62214753f648c0239"); // 1400000
     424             : 
     425         716 :         pchMessageStart[0] = 0xce;
     426         716 :         pchMessageStart[1] = 0xe2;
     427         716 :         pchMessageStart[2] = 0xca;
     428         716 :         pchMessageStart[3] = 0xff;
     429         716 :         nDefaultPort = 19999;
     430         716 :         nDefaultPlatformP2PPort = 22000;
     431         716 :         nDefaultPlatformHTTPPort = 22001;
     432         716 :         nPruneAfterHeight = 1000;
     433         716 :         m_assumed_blockchain_size = 10;
     434         716 :         m_assumed_chain_state_size = 1;
     435             : 
     436         716 :         genesis = CreateGenesisBlock(1390666206UL, 3861367235UL, 0x1e0ffff0, 1, 50 * COIN);
     437         716 :         consensus.hashGenesisBlock = genesis.GetHash();
     438         716 :         assert(consensus.hashGenesisBlock == uint256S("0x00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c"));
     439         716 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     440             : 
     441         716 :         vFixedSeeds.clear();
     442         716 :         vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));
     443             : 
     444         716 :         vSeeds.clear();
     445             :         // nodes with support for servicebits filtering should be at the top
     446         716 :         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         716 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
     450             :         // Testnet Dash script addresses start with '8' or '9'
     451         716 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
     452             :         // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
     453         716 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
     454             :         // Testnet Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
     455         716 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
     456             :         // Testnet Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
     457         716 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     458             : 
     459             :         // DIP-18 Dash Platform address HRP (bech32m)
     460         716 :         bech32_platform_hrp = "tdash";
     461             : 
     462             :         // Testnet Dash BIP44 coin type is '1' (All coin's testnet default)
     463         716 :         nExtCoinType = 1;
     464             : 
     465             :         // long living quorum params
     466         716 :         AddLLMQ(Consensus::LLMQType::LLMQ_50_60);
     467         716 :         AddLLMQ(Consensus::LLMQType::LLMQ_60_75);
     468         716 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_60);
     469         716 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_85);
     470         716 :         AddLLMQ(Consensus::LLMQType::LLMQ_100_67);
     471         716 :         AddLLMQ(Consensus::LLMQType::LLMQ_25_67);
     472         716 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_50_60;
     473         716 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_60_75;
     474         716 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_25_67;
     475         716 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_50_60;
     476             : 
     477         716 :         fDefaultConsistencyChecks = false;
     478         716 :         fRequireStandard = false;
     479         716 :         fRequireRoutableExternalIP = true;
     480         716 :         m_is_test_chain = true;
     481         716 :         fAllowMultipleAddressesFromGroup = false;
     482         716 :         nLLMQConnectionRetryTimeout = 60;
     483         716 :         m_is_mockable_chain = false;
     484             : 
     485         716 :         nPoolMinParticipants = 2;
     486         716 :         nPoolMaxParticipants = 20;
     487         716 :         nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
     488             : 
     489         716 :         vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"};
     490         716 :         nMinSporkKeys = 1;
     491             : 
     492         716 :         nCreditPoolPeriodBlocks = 576;
     493             : 
     494        1432 :         checkpointData = {
     495         716 :             {
     496         716 :                 {255, uint256S("0x0000080b600e06f4c07880673f027210f9314575f5f875fafe51971e268b886a")},
     497         716 :                 {261, uint256S("0x00000c26026d0815a7e2ce4fa270775f61403c040647ff2c3091f99e894a4618")},
     498         716 :                 {1999, uint256S("0x00000052e538d27fa53693efe6fb6892a0c1d26c0235f599171c48a3cce553b1")},
     499         716 :                 {2999, uint256S("0x0000024bc3f4f4cb30d29827c13d921ad77d2c6072e586c7f60d83c2722cdcc5")},
     500         716 :                 {96090, uint256S("0x00000000033df4b94d17ab43e999caaf6c4735095cc77703685da81254d09bba")},
     501         716 :                 {200000, uint256S("0x000000001015eb5ef86a8fe2b3074d947bc972c5befe32b28dd5ce915dc0d029")},
     502         716 :                 {395750, uint256S("0x000008b78b6aef3fd05ab78db8b76c02163e885305545144420cb08704dce538")},
     503         716 :                 {470000, uint256S("0x0000009303aeadf8cf3812f5c869691dbd4cb118ad20e9bf553be434bafe6a52")},
     504         716 :                 {794950, uint256S("0x000001860e4c7248a9c5cc3bc7106041750560dc5cd9b3a2641b49494bcff5f2")},
     505         716 :                 {808000, uint256S("0x00000104cb60a2b5e00a8a4259582756e5bf0dca201c0993c63f0e54971ea91a")},
     506         716 :                 {840000, uint256S("0x000000cd7c3084499912ae893125c13e8c3c656abb6e511dcec6619c3d65a510")},
     507         716 :                 {851000, uint256S("0x0000014d3b875540ff75517b7fbb1714e25d50ce92f65d7086cfce357928bb02")},
     508         716 :                 {905100, uint256S("0x0000020c5e0f86f385cbf8e90210de9a9fd63633f01433bf47a6b3227a2851fd")},
     509         716 :                 {960000, uint256S("0x0000000386cf5061ea16404c66deb83eb67892fa4f79b9e58e5eaab097ec2bd6")},
     510         716 :                 {1069875, uint256S("0x00000034bfeb926662ba547c0b8dd4ba8cbb6e0c581f4e7d1bddce8f9ca3a608")},
     511         716 :                 {1143608, uint256S("0x000000eef20eb0062abd4e799967e98bdebb165dd1c567ab4118c1c86c6e948f")},
     512         716 :                 {1189000, uint256S("0x000001690314036dfbbecbdf382b230ead8e9c584241290a51f9f05a87a9cf7e")},
     513         716 :                 {1295700, uint256S("0x00000107d42829a38e31c1a38c660d621e1ca376a880df1520e85e38af175d3a")},
     514         716 :                 {1380000, uint256S("0x000000a98084beaf77ed26a905a7d59979009e23367a55b5d634962d7d65a1f9")},
     515             :             }
     516             :         };
     517             : 
     518         716 :         m_assumeutxo_data = MapAssumeutxo{
     519             :             // TODO to be specified in a future patch.
     520             :         };
     521             : 
     522             :         // getchaintxstats 17280 000000a98084beaf77ed26a905a7d59979009e23367a55b5d634962d7d65a1f9
     523         716 :         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        1432 :     }
     530             : };
     531             : 
     532             : /**
     533             :  * Devnet: The Development network intended for developers use.
     534             :  */
     535             : class CDevNetParams : public CChainParams {
     536             : public:
     537        1260 :     explicit CDevNetParams(const ArgsManager& args) {
     538         630 :         strNetworkID = CBaseChainParams::DEVNET;
     539         630 :         consensus.nSubsidyHalvingInterval = 210240;
     540         630 :         consensus.nMasternodePaymentsStartBlock = 4010; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock
     541         630 :         consensus.nMasternodePaymentsIncreaseBlock = 4030;
     542         630 :         consensus.nMasternodePaymentsIncreasePeriod = 10;
     543         630 :         consensus.nInstantSendConfirmationsRequired = 2;
     544         630 :         consensus.nInstantSendKeepLock = 6;
     545         630 :         consensus.nBudgetPaymentsStartBlock = 4100;
     546         630 :         consensus.nBudgetPaymentsCycleBlocks = 50;
     547         630 :         consensus.nBudgetPaymentsWindowBlocks = 10;
     548         630 :         consensus.nSuperblockStartBlock = 4200; // NOTE: Should satisfy nSuperblockStartBlock > nBudgetPeymentsStartBlock
     549         630 :         consensus.nSuperblockStartHash = uint256(); // do not check this on devnet
     550         630 :         consensus.nSuperblockCycle = 24; // Superblocks can be issued hourly on devnet
     551         630 :         consensus.nSuperblockMaturityWindow = 8;
     552         630 :         consensus.nGovernanceMinQuorum = 1;
     553         630 :         consensus.nGovernanceFilterElements = 500;
     554         630 :         consensus.nMasternodeMinimumConfirmations = 1;
     555         630 :         consensus.BIP34Height = 1;   // BIP34 activated immediately on devnet
     556         630 :         consensus.BIP65Height = 1;   // BIP65 activated immediately on devnet
     557         630 :         consensus.BIP66Height = 1;   // BIP66 activated immediately on devnet
     558         630 :         consensus.BIP147Height = 1;  // BIP147 activated immediately on devnet
     559         630 :         consensus.CSVHeight = 1;     // BIP68 activated immediately on devnet
     560         630 :         consensus.DIP0001Height = 2; // DIP0001 activated immediately on devnet
     561         630 :         consensus.DIP0003Height = 2; // DIP0003 activated immediately on devnet
     562         630 :         consensus.DIP0003EnforcementHeight = 2; // DIP0003 activated immediately on devnet
     563         630 :         consensus.DIP0003EnforcementHash = uint256();
     564         630 :         consensus.DIP0008Height = 2; // DIP0008 activated immediately on devnet
     565         630 :         consensus.BRRHeight = 2;     // BRR (realloc) activated immediately on devnet
     566         630 :         consensus.DIP0020Height = 2; // DIP0020 activated immediately on devnet
     567         630 :         consensus.DIP0024Height = 2; // DIP0024 activated immediately on devnet
     568         630 :         consensus.DIP0024QuorumsHeight = 2; // DIP0024 activated immediately on devnet
     569         630 :         consensus.V19Height = 2;     // V19 activated immediately on devnet
     570         630 :         consensus.V20Height = 2;     // V20 activated immediately on devnet
     571         630 :         consensus.MN_RRHeight = 2;   // MN_RR activated immediately on devnet
     572         630 :         consensus.WithdrawalsHeight = 2;   // withdrawals activated immediately on devnet
     573         630 :         consensus.MinBIP9WarningHeight = 2 + 2016; // withdrawals activation height + miner confirmation window
     574         630 :         consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
     575         630 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     576         630 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     577         630 :         consensus.fPowAllowMinDifficultyBlocks = true;
     578         630 :         consensus.fPowNoRetargeting = false;
     579         630 :         consensus.nPowKGWHeight = 4001; // nPowKGWHeight >= nPowDGWHeight means "no KGW"
     580         630 :         consensus.nPowDGWHeight = 4001;
     581         630 :         consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
     582         630 :         consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
     583         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     584         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
     585         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     586         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     587             : 
     588         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     589         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = 1751328000;    // July 1, 2025
     590         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     591         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 120;
     592         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 96;       // 80% of 120
     593         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 72;         // 60% of 120
     594         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;          // this corresponds to 10 periods
     595         630 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     596             : 
     597         630 :         consensus.nMinimumChainWork = uint256{};
     598         630 :         consensus.defaultAssumeValid = uint256{};
     599             : 
     600         630 :         pchMessageStart[0] = 0xe2;
     601         630 :         pchMessageStart[1] = 0xca;
     602         630 :         pchMessageStart[2] = 0xff;
     603         630 :         pchMessageStart[3] = 0xce;
     604         630 :         nDefaultPort = 19799;
     605         630 :         nDefaultPlatformP2PPort = 22100;
     606         630 :         nDefaultPlatformHTTPPort = 22101;
     607         630 :         nPruneAfterHeight = 1000;
     608         630 :         m_assumed_blockchain_size = 0;
     609         630 :         m_assumed_chain_state_size = 0;
     610             : 
     611         630 :         UpdateDevnetSubsidyAndDiffParametersFromArgs(args);
     612         630 :         genesis = CreateGenesisBlock(1417713337, 1096447, 0x207fffff, 1, 50 * COIN);
     613         630 :         consensus.hashGenesisBlock = genesis.GetHash();
     614         630 :         assert(consensus.hashGenesisBlock == uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"));
     615         630 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     616             : 
     617         630 :         devnetGenesis = FindDevNetGenesisBlock(genesis, 50 * COIN);
     618         630 :         consensus.hashDevnetGenesisBlock = devnetGenesis.GetHash();
     619             : 
     620         630 :         vFixedSeeds.clear();
     621         630 :         vSeeds.clear();
     622             :         //vSeeds.push_back(CDNSSeedData("dashevo.org.",  "devnet-seed.dashevo.org."));
     623             : 
     624             :         // Testnet Dash addresses start with 'y'
     625         630 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
     626             :         // Testnet Dash script addresses start with '8' or '9'
     627         630 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
     628             :         // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
     629         630 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
     630             :         // Testnet Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
     631         630 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
     632             :         // Testnet Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
     633         630 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     634             : 
     635             :         // DIP-18 Dash Platform address HRP (bech32m)
     636         630 :         bech32_platform_hrp = "tdash";
     637             : 
     638             :         // Testnet Dash BIP44 coin type is '1' (All coin's testnet default)
     639         630 :         nExtCoinType = 1;
     640             : 
     641             :         // long living quorum params
     642         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_50_60);
     643         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_60_75);
     644         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_60);
     645         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_400_85);
     646         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_100_67);
     647         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_DEVNET);
     648         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_DEVNET_DIP0024);
     649         630 :         AddLLMQ(Consensus::LLMQType::LLMQ_DEVNET_PLATFORM);
     650         630 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_DEVNET;
     651         630 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_DEVNET_DIP0024;
     652         630 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_DEVNET_PLATFORM;
     653         630 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_DEVNET;
     654             : 
     655         630 :         UpdateDevnetLLMQChainLocksFromArgs(args);
     656         630 :         UpdateDevnetLLMQInstantSendDIP0024FromArgs(args);
     657         630 :         UpdateDevnetLLMQPlatformFromArgs(args);
     658         630 :         UpdateDevnetLLMQMnhfFromArgs(args);
     659         630 :         UpdateLLMQDevnetParametersFromArgs(args);
     660         630 :         UpdateDevnetPowTargetSpacingFromArgs(args);
     661             : 
     662         630 :         fDefaultConsistencyChecks = false;
     663         630 :         fRequireStandard = false;
     664         630 :         fRequireRoutableExternalIP = true;
     665         630 :         m_is_test_chain = true;
     666         630 :         fAllowMultipleAddressesFromGroup = true;
     667         630 :         nLLMQConnectionRetryTimeout = 60;
     668         630 :         m_is_mockable_chain = false;
     669             : 
     670         630 :         nPoolMinParticipants = 2;
     671         630 :         nPoolMaxParticipants = 20;
     672         630 :         nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
     673             : 
     674         630 :         vSporkAddresses = {"yjPtiKh2uwk3bDutTEA2q9mCtXyiZRWn55"};
     675         630 :         nMinSporkKeys = 1;
     676             : 
     677         630 :         nCreditPoolPeriodBlocks = 576;
     678             : 
     679        1260 :         checkpointData = (CCheckpointData) {
     680         630 :             {
     681         630 :                 { 0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")},
     682         630 :                 { 1, devnetGenesis.GetHash() },
     683             :             }
     684             :         };
     685             : 
     686         630 :         chainTxData = ChainTxData{
     687         630 :             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        1260 :     }
     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        1630 :     explicit CRegTestParams(const ArgsManager& args) {
     772         815 :         strNetworkID =  CBaseChainParams::REGTEST;
     773         815 :         consensus.nSubsidyHalvingInterval = 150;
     774         815 :         consensus.nMasternodePaymentsStartBlock = 240;
     775         815 :         consensus.nMasternodePaymentsIncreaseBlock = 350;
     776         815 :         consensus.nMasternodePaymentsIncreasePeriod = 10;
     777         815 :         consensus.nInstantSendConfirmationsRequired = 2;
     778         815 :         consensus.nInstantSendKeepLock = 6;
     779         815 :         consensus.nBudgetPaymentsStartBlock = 1000;
     780         815 :         consensus.nBudgetPaymentsCycleBlocks = 50;
     781         815 :         consensus.nBudgetPaymentsWindowBlocks = 10;
     782         815 :         consensus.nSuperblockStartBlock = 1500;
     783         815 :         consensus.nSuperblockStartHash = uint256(); // do not check this on regtest
     784         815 :         consensus.nSuperblockCycle = 20;
     785         815 :         consensus.nSuperblockMaturityWindow = 10;
     786         815 :         consensus.nGovernanceMinQuorum = 1;
     787         815 :         consensus.nGovernanceFilterElements = 100;
     788         815 :         consensus.nMasternodeMinimumConfirmations = 1;
     789         815 :         consensus.BIP34Height = 1;   // Always active unless overridden
     790         815 :         consensus.BIP34Hash = uint256();
     791         815 :         consensus.BIP65Height = 1;   // Always active unless overridden
     792         815 :         consensus.BIP66Height = 1;   // Always active unless overridden
     793         815 :         consensus.BIP147Height = 0;  // Always active unless overridden
     794         815 :         consensus.CSVHeight = 1;     // Always active unless overridden
     795         815 :         consensus.DIP0001Height = 1; // Always active unless overridden
     796         815 :         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         815 :         consensus.DIP0003EnforcementHeight = 500;
     799         815 :         consensus.DIP0003EnforcementHash = uint256();
     800         815 :         consensus.DIP0008Height = 1; // Always active unless overridden
     801         815 :         consensus.BRRHeight = 1;     // Always active unless overridden
     802         815 :         consensus.DIP0020Height = 1; // Always active unless overridden
     803         815 :         consensus.DIP0024Height = 1; // Always have dip0024 quorums unless overridden
     804         815 :         consensus.DIP0024QuorumsHeight = 1; // Always have dip0024 quorums unless overridden
     805         815 :         consensus.V19Height = 1; // Always active unless overridden
     806         815 :         consensus.V20Height = consensus.DIP0003Height; // Active not earlier than dip0003. Functional tests (DashTestFramework) uses height 100 (same as coinbase maturity)
     807         815 :         consensus.MN_RRHeight = consensus.V20Height; // MN_RR does not really have effect before v20 activation
     808         815 :         consensus.WithdrawalsHeight = 600;
     809         815 :         consensus.MinBIP9WarningHeight = 0;
     810         815 :         consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1
     811         815 :         consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
     812         815 :         consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
     813         815 :         consensus.fPowAllowMinDifficultyBlocks = true;
     814         815 :         consensus.fPowNoRetargeting = true;
     815         815 :         consensus.nPowKGWHeight = 15200; // same as mainnet
     816         815 :         consensus.nPowDGWHeight = 34140; // same as mainnet
     817         815 :         consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
     818         815 :         consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
     819             : 
     820         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
     821         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
     822         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     823         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
     824             : 
     825         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].bit = 12;
     826         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nStartTime = 0;
     827         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
     828         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nWindowSize = 250;
     829         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdStart = 250 / 5 * 4;     // 80% of window size
     830         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nThresholdMin = 250 / 5 * 3;       // 60% of window size
     831         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].nFalloffCoeff = 5;                 // this corresponds to 10 periods
     832         815 :         consensus.vDeployments[Consensus::DEPLOYMENT_V24].useEHF = true;
     833             : 
     834         815 :         consensus.nMinimumChainWork = uint256{};
     835         815 :         consensus.defaultAssumeValid = uint256{};
     836             : 
     837         815 :         pchMessageStart[0] = 0xfc;
     838         815 :         pchMessageStart[1] = 0xc1;
     839         815 :         pchMessageStart[2] = 0xb7;
     840         815 :         pchMessageStart[3] = 0xdc;
     841         815 :         nDefaultPort = 19899;
     842         815 :         nDefaultPlatformP2PPort = 22200;
     843         815 :         nDefaultPlatformHTTPPort = 22201;
     844         815 :         nPruneAfterHeight = args.GetBoolArg("-fastprune", false) ? 100 : 1000;
     845         815 :         m_assumed_blockchain_size = 0;
     846         815 :         m_assumed_chain_state_size = 0;
     847             : 
     848         815 :         UpdateActivationParametersFromArgs(args);
     849         815 :         UpdateDIP3ParametersFromArgs(args);
     850         815 :         UpdateBudgetParametersFromArgs(args);
     851             : 
     852         815 :         genesis = CreateGenesisBlock(1417713337, 1096447, 0x207fffff, 1, 50 * COIN);
     853         815 :         consensus.hashGenesisBlock = genesis.GetHash();
     854         815 :         assert(consensus.hashGenesisBlock == uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e"));
     855         815 :         assert(genesis.hashMerkleRoot == uint256S("0xe0028eb9648db56b1ac77cf090b99048a8007e2bb64b68f092c03c7f56a662c7"));
     856             : 
     857         815 :         vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
     858         815 :         vSeeds.clear();
     859         815 :         vSeeds.emplace_back("dummySeed.invalid.");
     860             : 
     861         815 :         fDefaultConsistencyChecks = true;
     862         815 :         fRequireStandard = true;
     863         815 :         fRequireRoutableExternalIP = false;
     864         815 :         m_is_test_chain = true;
     865         815 :         fAllowMultipleAddressesFromGroup = true;
     866         815 :         nLLMQConnectionRetryTimeout = 1; // must be lower then the LLMQ signing session timeout so that tests have control over failing behavior
     867         815 :         m_is_mockable_chain = true;
     868             : 
     869         815 :         nFulfilledRequestExpireTime = 5*60; // fulfilled requests expire in 5 minutes
     870         815 :         nPoolMinParticipants = 2;
     871         815 :         nPoolMaxParticipants = 20;
     872             : 
     873             :         // privKey: cP4EKFyJsHT39LDqgdcB43Y3YXjNyjb5Fuas1GQSeAtjnZWmZEQK
     874         815 :         vSporkAddresses = {"yj949n1UH6fDhw6HtVE5VMj2iSTaSWBMcW"};
     875         815 :         nMinSporkKeys = 1;
     876             : 
     877         815 :         nCreditPoolPeriodBlocks = 100;
     878             : 
     879        1630 :         checkpointData = {
     880         815 :             {
     881         815 :                 {0, uint256S("0x000008ca1832a4baf228eb1553c03d3a2c8e02399550dd6ea8d65cec3ef23d2e")},
     882             :             }
     883             :         };
     884             : 
     885        1630 :         m_assumeutxo_data = MapAssumeutxo{
     886         815 :             {
     887         815 :                 110,
     888         815 :                 {AssumeutxoHash{uint256S("0x9b2a277a3e3b979f1a539d57e949495d7f8247312dbc32bce6619128c192b44b")}, 110},
     889             :             },
     890         815 :             {
     891         815 :                 200,
     892         815 :                 {AssumeutxoHash{uint256S("0x8a5bdd92252fc6b24663244bbe958c947bb036dc1f94ccd15439f48d8d1cb4e3")}, 200},
     893             :             },
     894             :         };
     895             : 
     896         815 :         chainTxData = ChainTxData{
     897             :             0,
     898             :             0,
     899             :             0
     900             :         };
     901             : 
     902             :         // Regtest Dash addresses start with 'y'
     903         815 :         base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,140);
     904             :         // Regtest Dash script addresses start with '8' or '9'
     905         815 :         base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,19);
     906             :         // Regtest private keys start with '9' or 'c' (Bitcoin defaults)
     907         815 :         base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
     908             :         // Regtest Dash BIP32 pubkeys start with 'tpub' (Bitcoin defaults)
     909         815 :         base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
     910             :         // Regtest Dash BIP32 prvkeys start with 'tprv' (Bitcoin defaults)
     911         815 :         base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
     912             : 
     913             :         // DIP-18 Dash Platform address HRP (bech32m)
     914         815 :         bech32_platform_hrp = "tdash";
     915             : 
     916             :         // Regtest Dash BIP44 coin type is '1' (All coin's testnet default)
     917         815 :         nExtCoinType = 1;
     918             : 
     919             :         // long living quorum params
     920         815 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST);
     921         815 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_INSTANTSEND);
     922         815 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_V17);
     923         815 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_DIP0024);
     924         815 :         AddLLMQ(Consensus::LLMQType::LLMQ_TEST_PLATFORM);
     925         815 :         consensus.llmqTypeChainLocks = Consensus::LLMQType::LLMQ_TEST;
     926         815 :         consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_TEST_DIP0024;
     927         815 :         consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_TEST_PLATFORM;
     928         815 :         consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_TEST;
     929             : 
     930         815 :         UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST);
     931         815 :         UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_INSTANTSEND);
     932         815 :         UpdateLLMQTestParametersFromArgs(args, Consensus::LLMQType::LLMQ_TEST_PLATFORM);
     933         815 :         UpdateLLMQInstantSendDIP0024FromArgs(args);
     934             :         // V20 features for CbTx (credit pool, CL) have no meaning without masternodes
     935         815 :         assert(consensus.V20Height >= consensus.DIP0003Height);
     936             :         // MN_RR reallocate part of reward to CreditPool which exits since V20
     937         815 :         assert(consensus.MN_RRHeight >= consensus.V20Height);
     938        1630 :     }
     939             : 
     940             :     /**
     941             :      * Allows modifying the Version Bits regtest parameters.
     942             :      */
     943          25 :     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          25 :         consensus.vDeployments[d].nStartTime = nStartTime;
     946          25 :         consensus.vDeployments[d].nTimeout = nTimeout;
     947          25 :         consensus.vDeployments[d].min_activation_height = min_activation_height;
     948          25 :         if (nWindowSize != -1) {
     949          23 :             consensus.vDeployments[d].nWindowSize = nWindowSize;
     950          23 :         }
     951          25 :         if (nThresholdStart != -1) {
     952          23 :             consensus.vDeployments[d].nThresholdStart = nThresholdStart;
     953          23 :         }
     954          25 :         if (nThresholdMin != -1) {
     955          23 :             consensus.vDeployments[d].nThresholdMin = nThresholdMin;
     956          23 :         }
     957          25 :         if (nFalloffCoeff != -1) {
     958          23 :             consensus.vDeployments[d].nFalloffCoeff = nFalloffCoeff;
     959          23 :         }
     960          25 :         if (nUseEHF != -1) {
     961          23 :             consensus.vDeployments[d].useEHF = nUseEHF > 0;
     962          23 :         }
     963          25 :     }
     964             :     void UpdateActivationParametersFromArgs(const ArgsManager& args);
     965             : 
     966             :     /**
     967             :      * Allows modifying the DIP3 activation and enforcement height
     968             :      */
     969           1 :     void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
     970             :     {
     971           1 :         consensus.DIP0003Height = nActivationHeight;
     972           1 :         consensus.DIP0003EnforcementHeight = nEnforcementHeight;
     973           1 :     }
     974             :     void UpdateDIP3ParametersFromArgs(const ArgsManager& args);
     975             : 
     976             :     /**
     977             :      * Allows modifying the budget regtest parameters.
     978             :      */
     979           0 :     void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
     980             :     {
     981           0 :         consensus.nMasternodePaymentsStartBlock = nMasternodePaymentsStartBlock;
     982           0 :         consensus.nBudgetPaymentsStartBlock = nBudgetPaymentsStartBlock;
     983           0 :         consensus.nSuperblockStartBlock = nSuperblockStartBlock;
     984           0 :     }
     985             :     void UpdateBudgetParametersFromArgs(const ArgsManager& args);
     986             : 
     987             :     /**
     988             :      * Allows modifying parameters of the test LLMQ
     989             :      */
     990           0 :     void UpdateLLMQTestParameters(int size, int threshold, const Consensus::LLMQType llmqType)
     991             :     {
     992           0 :         auto params = std::ranges::find_if(consensus.llmqs, [llmqType](const auto& llmq){ return llmq.type == llmqType;});
     993           0 :         assert(params != consensus.llmqs.end());
     994           0 :         params->size = size;
     995           0 :         params->minSize = threshold;
     996           0 :         params->threshold = threshold;
     997           0 :         params->dkgBadVotesThreshold = threshold;
     998           0 :     }
     999             : 
    1000             :     /**
    1001             :      * Allows modifying the LLMQ type for InstantSend (DIP0024).
    1002             :      */
    1003           0 :     void UpdateLLMQDIP0024InstantSend(Consensus::LLMQType llmqType)
    1004             :     {
    1005           0 :         consensus.llmqTypeDIP0024InstantSend = llmqType;
    1006           0 :     }
    1007             : 
    1008             :     void UpdateLLMQTestParametersFromArgs(const ArgsManager& args, const Consensus::LLMQType llmqType);
    1009             :     void UpdateLLMQInstantSendDIP0024FromArgs(const ArgsManager& args);
    1010             : };
    1011             : 
    1012         815 : static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& consensus)
    1013             : {
    1014         859 :     for (const std::string& arg : args.GetArgs("-testactivationheight")) {
    1015          44 :         const auto found{arg.find('@')};
    1016          44 :         if (found == std::string::npos) {
    1017           0 :             throw std::runtime_error(strprintf("Invalid format (%s) for -testactivationheight=name@height.", arg));
    1018             :         }
    1019          44 :         const auto name{arg.substr(0, found)};
    1020          44 :         const auto value{arg.substr(found + 1)};
    1021             :         int32_t height;
    1022          44 :         if (!ParseInt32(value, &height) || height < 0 || height >= std::numeric_limits<int>::max()) {
    1023           0 :             throw std::runtime_error(strprintf("Invalid height value (%s) for -testactivationheight=name@height.", arg));
    1024             :         }
    1025          44 :         if (name == "bip147") {
    1026           0 :             consensus.BIP147Height = int{height};
    1027          44 :         } else if (name == "bip34") {
    1028           0 :             consensus.BIP34Height = int{height};
    1029          44 :         } else if (name == "dersig") {
    1030           3 :             consensus.BIP66Height = int{height};
    1031          44 :         } else if (name == "cltv") {
    1032           0 :             consensus.BIP65Height = int{height};
    1033          41 :         } else if (name == "csv") {
    1034           0 :             consensus.CSVHeight = int{height};
    1035          41 :         } else if (name == "brr") {
    1036           1 :             consensus.BRRHeight = int{height};
    1037          41 :         } else if (name == "dip0001") {
    1038           8 :             consensus.DIP0001Height = int{height};
    1039          40 :         } else if (name == "dip0008") {
    1040           0 :             consensus.DIP0008Height = int{height};
    1041          32 :         } else if (name == "dip0024") {
    1042           0 :             consensus.DIP0024Height = int{height};
    1043           0 :             consensus.DIP0024QuorumsHeight = int{height};
    1044          32 :         } else if (name == "v19") {
    1045          12 :             consensus.V19Height = int{height};
    1046          32 :         } else if (name == "v20") {
    1047          10 :             consensus.V20Height = int{height};
    1048          20 :         } else if (name == "mn_rr") {
    1049          10 :             consensus.MN_RRHeight = int{height};
    1050          10 :         } else {
    1051           0 :             throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
    1052             :         }
    1053          44 :     }
    1054         815 : }
    1055             : 
    1056         815 : void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args)
    1057             : {
    1058         815 :     MaybeUpdateHeights(args, consensus);
    1059             : 
    1060         815 :     if (!args.IsArgSet("-vbparams")) return;
    1061             : 
    1062          50 :     for (const std::string& strDeployment : args.GetArgs("-vbparams")) {
    1063          25 :         std::vector<std::string> vDeploymentParams = SplitString(strDeployment, ':');
    1064          25 :         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          25 :         int64_t nStartTime, nTimeout, nWindowSize = -1, nThresholdStart = -1, nThresholdMin = -1, nFalloffCoeff = -1, nUseEHF = -1;
    1072          25 :         int min_activation_height = 0;
    1073          25 :         if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
    1074           0 :             throw std::runtime_error(strprintf("Invalid nStartTime (%s)", vDeploymentParams[1]));
    1075             :         }
    1076          25 :         if (!ParseInt64(vDeploymentParams[2], &nTimeout)) {
    1077           0 :             throw std::runtime_error(strprintf("Invalid nTimeout (%s)", vDeploymentParams[2]));
    1078             :         }
    1079          25 :         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          25 :         if (vDeploymentParams.size() >= 6) {
    1083          23 :             if (!ParseInt64(vDeploymentParams[4], &nWindowSize)) {
    1084           0 :                 throw std::runtime_error(strprintf("Invalid nWindowSize (%s)", vDeploymentParams[4]));
    1085             :             }
    1086          23 :             if (!ParseInt64(vDeploymentParams[5], &nThresholdStart)) {
    1087           0 :                 throw std::runtime_error(strprintf("Invalid nThresholdStart (%s)", vDeploymentParams[5]));
    1088             :             }
    1089          23 :         }
    1090          25 :         if (vDeploymentParams.size() == 9) {
    1091          23 :             if (!ParseInt64(vDeploymentParams[6], &nThresholdMin)) {
    1092           0 :                 throw std::runtime_error(strprintf("Invalid nThresholdMin (%s)", vDeploymentParams[6]));
    1093             :             }
    1094          23 :             if (!ParseInt64(vDeploymentParams[7], &nFalloffCoeff)) {
    1095           0 :                 throw std::runtime_error(strprintf("Invalid nFalloffCoeff (%s)", vDeploymentParams[7]));
    1096             :             }
    1097          23 :             if (!ParseInt64(vDeploymentParams[8], &nUseEHF)) {
    1098           0 :                 throw std::runtime_error(strprintf("Invalid nUseEHF (%s)", vDeploymentParams[8]));
    1099             :             }
    1100          23 :         }
    1101          25 :         bool found = false;
    1102          25 :         for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
    1103          25 :             if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
    1104          25 :                 UpdateVersionBitsParameters(Consensus::DeploymentPos(j), nStartTime, nTimeout, min_activation_height, nWindowSize, nThresholdStart, nThresholdMin, nFalloffCoeff, nUseEHF);
    1105          25 :                 found = true;
    1106          25 :                 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          25 :                 break;
    1109             :             }
    1110           0 :         }
    1111          25 :         if (!found) {
    1112           0 :             throw std::runtime_error(strprintf("Invalid deployment (%s)", vDeploymentParams[0]));
    1113             :         }
    1114          25 :     }
    1115         815 : }
    1116             : 
    1117         815 : void CRegTestParams::UpdateDIP3ParametersFromArgs(const ArgsManager& args)
    1118             : {
    1119         815 :     if (!args.IsArgSet("-dip3params")) return;
    1120             : 
    1121           1 :     std::string strParams = args.GetArg("-dip3params", "");
    1122           1 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1123           1 :     if (vParams.size() != 2) {
    1124           0 :         throw std::runtime_error("DIP3 parameters malformed, expecting <activation>:<enforcement>");
    1125             :     }
    1126             :     int nDIP3ActivationHeight, nDIP3EnforcementHeight;
    1127           1 :     if (!ParseInt32(vParams[0], &nDIP3ActivationHeight)) {
    1128           0 :         throw std::runtime_error(strprintf("Invalid activation height (%s)", vParams[0]));
    1129             :     }
    1130           1 :     if (!ParseInt32(vParams[1], &nDIP3EnforcementHeight)) {
    1131           0 :         throw std::runtime_error(strprintf("Invalid enforcement height (%s)", vParams[1]));
    1132             :     }
    1133           1 :     LogPrintf("Setting DIP3 parameters to activation=%ld, enforcement=%ld\n", nDIP3ActivationHeight, nDIP3EnforcementHeight);
    1134           1 :     UpdateDIP3Parameters(nDIP3ActivationHeight, nDIP3EnforcementHeight);
    1135         815 : }
    1136             : 
    1137         815 : void CRegTestParams::UpdateBudgetParametersFromArgs(const ArgsManager& args)
    1138             : {
    1139         815 :     if (!args.IsArgSet("-budgetparams")) return;
    1140             : 
    1141           0 :     std::string strParams = args.GetArg("-budgetparams", "");
    1142           0 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1143           0 :     if (vParams.size() != 3) {
    1144           0 :         throw std::runtime_error("Budget parameters malformed, expecting <masternode>:<budget>:<superblock>");
    1145             :     }
    1146             :     int nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock;
    1147           0 :     if (!ParseInt32(vParams[0], &nMasternodePaymentsStartBlock)) {
    1148           0 :         throw std::runtime_error(strprintf("Invalid masternode start height (%s)", vParams[0]));
    1149             :     }
    1150           0 :     if (!ParseInt32(vParams[1], &nBudgetPaymentsStartBlock)) {
    1151           0 :         throw std::runtime_error(strprintf("Invalid budget start block (%s)", vParams[1]));
    1152             :     }
    1153           0 :     if (!ParseInt32(vParams[2], &nSuperblockStartBlock)) {
    1154           0 :         throw std::runtime_error(strprintf("Invalid superblock start height (%s)", vParams[2]));
    1155             :     }
    1156           0 :     LogPrintf("Setting budget parameters to masternode=%ld, budget=%ld, superblock=%ld\n", nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
    1157           0 :     UpdateBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
    1158         815 : }
    1159             : 
    1160        2445 : void CRegTestParams::UpdateLLMQTestParametersFromArgs(const ArgsManager& args, const Consensus::LLMQType llmqType)
    1161             : {
    1162        2445 :     assert(llmqType == Consensus::LLMQType::LLMQ_TEST || llmqType == Consensus::LLMQType::LLMQ_TEST_INSTANTSEND || llmqType == Consensus::LLMQType::LLMQ_TEST_PLATFORM);
    1163             : 
    1164        2445 :     std::string cmd_param{"-llmqtestparams"}, llmq_name{"LLMQ_TEST"};
    1165        2445 :     if (llmqType == Consensus::LLMQType::LLMQ_TEST_INSTANTSEND) {
    1166         815 :         cmd_param = "-llmqtestinstantsendparams";
    1167         815 :         llmq_name = "LLMQ_TEST_INSTANTSEND";
    1168         815 :     }
    1169        2445 :     if (llmqType == Consensus::LLMQType::LLMQ_TEST_PLATFORM) {
    1170         815 :         cmd_param = "-llmqtestplatformparams";
    1171         815 :         llmq_name = "LLMQ_TEST_PLATFORM";
    1172         815 :     }
    1173             : 
    1174        2445 :     if (!args.IsArgSet(cmd_param)) return;
    1175             : 
    1176           0 :     std::string strParams = args.GetArg(cmd_param, "");
    1177           0 :     std::vector<std::string> vParams = SplitString(strParams, ':');
    1178           0 :     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           0 :     if (!ParseInt32(vParams[0], &size)) {
    1183           0 :         throw std::runtime_error(strprintf("Invalid %s size (%s)", llmq_name, vParams[0]));
    1184             :     }
    1185           0 :     if (!ParseInt32(vParams[1], &threshold)) {
    1186           0 :         throw std::runtime_error(strprintf("Invalid %s threshold (%s)", llmq_name, vParams[1]));
    1187             :     }
    1188           0 :     LogPrintf("Setting %s parameters to size=%ld, threshold=%ld\n", llmq_name, size, threshold);
    1189           0 :     UpdateLLMQTestParameters(size, threshold, llmqType);
    1190        2445 : }
    1191             : 
    1192         815 : void CRegTestParams::UpdateLLMQInstantSendDIP0024FromArgs(const ArgsManager& args)
    1193             : {
    1194         815 :     if (!args.IsArgSet("-llmqtestinstantsenddip0024")) return;
    1195             : 
    1196           0 :     const auto& llmq_params_opt = GetLLMQ(consensus.llmqTypeDIP0024InstantSend);
    1197           0 :     assert(llmq_params_opt.has_value());
    1198             : 
    1199           0 :     std::string strLLMQType = gArgs.GetArg("-llmqtestinstantsenddip0024", std::string(llmq_params_opt->name));
    1200             : 
    1201           0 :     Consensus::LLMQType llmqType = Consensus::LLMQType::LLMQ_NONE;
    1202           0 :     for (const auto& params : consensus.llmqs) {
    1203           0 :         if (params.name == strLLMQType) {
    1204           0 :             llmqType = params.type;
    1205           0 :         }
    1206             :     }
    1207           0 :     if (llmqType == Consensus::LLMQType::LLMQ_NONE) {
    1208           0 :         throw std::runtime_error("Invalid LLMQ type specified for -llmqtestinstantsenddip0024.");
    1209             :     }
    1210           0 :     LogPrintf("Setting llmqtestinstantsenddip0024 to %ld\n", std23::to_underlying(llmqType));
    1211           0 :     UpdateLLMQDIP0024InstantSend(llmqType);
    1212         815 : }
    1213             : 
    1214         630 : void CDevNetParams::UpdateDevnetSubsidyAndDiffParametersFromArgs(const ArgsManager& args)
    1215             : {
    1216         630 :     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         630 : }
    1224             : 
    1225         630 : void CDevNetParams::UpdateDevnetLLMQChainLocksFromArgs(const ArgsManager& args)
    1226             : {
    1227         630 :     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         630 : }
    1249             : 
    1250         630 : void CDevNetParams::UpdateDevnetLLMQInstantSendDIP0024FromArgs(const ArgsManager& args)
    1251             : {
    1252         630 :     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         630 : }
    1274             : 
    1275         630 : void CDevNetParams::UpdateDevnetLLMQPlatformFromArgs(const ArgsManager& args)
    1276             : {
    1277         630 :     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         630 : }
    1296             : 
    1297         630 : void CDevNetParams::UpdateDevnetLLMQMnhfFromArgs(const ArgsManager& args)
    1298             : {
    1299         630 :     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         630 : }
    1318             : 
    1319         630 : void CDevNetParams::UpdateDevnetPowTargetSpacingFromArgs(const ArgsManager& args)
    1320             : {
    1321         630 :     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         630 : }
    1337             : 
    1338         630 : void CDevNetParams::UpdateLLMQDevnetParametersFromArgs(const ArgsManager& args)
    1339             : {
    1340         630 :     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         630 : }
    1357             : 
    1358             : static std::unique_ptr<const CChainParams> globalChainParams;
    1359             : 
    1360     1853730 : const CChainParams &Params() {
    1361     1853730 :     assert(globalChainParams);
    1362     1853730 :     return *globalChainParams;
    1363             : }
    1364             : 
    1365        3502 : std::unique_ptr<const CChainParams> CreateChainParams(const ArgsManager& args, const std::string& chain)
    1366             : {
    1367        3502 :     if (chain == CBaseChainParams::MAIN) {
    1368        1341 :         return std::unique_ptr<CChainParams>(new CMainParams());
    1369        2161 :     } else if (chain == CBaseChainParams::TESTNET) {
    1370         716 :         return std::unique_ptr<CChainParams>(new CTestNetParams());
    1371        1445 :     } else if (chain == CBaseChainParams::DEVNET) {
    1372         630 :         return std::unique_ptr<CChainParams>(new CDevNetParams(args));
    1373         815 :     } else if (chain == CBaseChainParams::REGTEST) {
    1374         815 :         return std::unique_ptr<CChainParams>(new CRegTestParams(args));
    1375             :     }
    1376           0 :     throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
    1377        3502 : }
    1378             : 
    1379         967 : void SelectParams(const std::string& network)
    1380             : {
    1381         967 :     SelectBaseParams(network);
    1382         967 :     globalChainParams = CreateChainParams(gArgs, network);
    1383         967 : }
    1384             : 
    1385         627 : void SetupChainParamsOptions(ArgsManager& argsman)
    1386             : {
    1387         627 :     SetupChainParamsBaseOptions(argsman);
    1388             : 
    1389         627 :     argsman.AddArg("-budgetparams=<masternode>:<budget>:<superblock>", "Override masternode, budget and superblock start heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1390         627 :     argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1391         627 :     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         627 :     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         627 :     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         627 :     argsman.AddArg("-llmqdevnetparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_DEVNET quorum (devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1395         627 :     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         627 :     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         627 :     argsman.AddArg("-llmqmnhf=<quorum name>", "Override the default LLMQ type used for EHF. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
    1398         627 :     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         627 :     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         627 :     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         627 :     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         627 :     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         627 :     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         627 :     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         627 :     argsman.AddArg("-vbparams=<deployment>:<start>:<end>(:min_activation_height(:<window>:<threshold/thresholdstart>(:<thresholdmin>:<falloffcoeff>:<mnactivation>)))",
    1406         627 :                  "Use given start/end times and min_activation_height for specified version bits deployment (regtest-only). "
    1407         627 :                  "Specifying window, threshold/thresholdstart, thresholdmin, falloffcoeff and mnactivation is optional.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
    1408         627 : }

Generated by: LCOV version 1.16