1 // Copyright (c) 2009-2010 Satoshi Nakamoto 2 // Copyright (c) 2009-2015 The Bitcoin Core developers 3 // Distributed under the MIT software license, see the accompanying 4 // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 6 #ifndef BITCOIN_CONSENSUS_PARAMS_H 7 #define BITCOIN_CONSENSUS_PARAMS_H 8 9 #include "uint256.h" 10 #include <map> 11 #include <string> 12 13 namespace Consensus { 14 15 enum DeploymentPos 16 { 17 DEPLOYMENT_TESTDUMMY, 18 DEPLOYMENT_CSV, // Deployment of BIP68, BIP112, and BIP113. 19 DEPLOYMENT_SEGWIT, // Deployment of BIP141, BIP143, and BIP147. 20 // NOTE: Also add new deployments to VersionBitsDeploymentInfo in versionbits.cpp 21 MAX_VERSION_BITS_DEPLOYMENTS 22 }; 23 24 /** 25 * Struct for each individual consensus rule change using BIP9. 26 */ 27 struct BIP9Deployment { 28 /** Bit position to select the particular bit in nVersion. */ 29 int bit; 30 /** Start MedianTime for version bits miner confirmation. Can be a date in the past */ 31 int64_t nStartTime; 32 /** Timeout/expiry MedianTime for the deployment attempt. */ 33 int64_t nTimeout; 34 }; 35 36 /** 37 * Parameters that influence chain consensus. 38 */ 39 struct Params { 40 uint256 hashGenesisBlock; 41 int nSubsidyHalvingInterval; 42 /** Block height and hash at which BIP34 becomes active */ 43 //int BIP34Height; 44 //uint256 BIP34Hash; 45 /** 46 * Minimum blocks including miner confirmation of the total of 2016 blocks in a retargetting period, 47 * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments. 48 * Examples: 1916 for 95%, 1512 for testchains. 49 */ 50 uint32_t nRuleChangeActivationThreshold; 51 uint32_t nMinerConfirmationWindow; 52 BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]; 53 /** Proof of work parameters */ 54 uint256 powLimit; 55 bool fPowAllowMinDifficultyBlocks; 56 bool fPowNoRetargeting; 57 int64_t nPowTargetSpacing; 58 int64_t nPowTargetTimespan; DifficultyAdjustmentIntervalParams59 int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; } 60 //uint256 nMinimumChainWork; 61 }; 62 } // namespace Consensus 63 64 #endif // BITCOIN_CONSENSUS_PARAMS_H 65