1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 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.
6 #ifndef BITCOIN_CONSENSUS_PARAMS_H
7 #define BITCOIN_CONSENSUS_PARAMS_H
19 DEPLOYMENT_CSV
, // Deployment of BIP68, BIP112, and BIP113.
20 DEPLOYMENT_SEGWIT
, // Deployment of BIP141, BIP143, and BIP147.
21 // NOTE: Also add new deployments to VersionBitsDeploymentInfo in versionbits.cpp
22 MAX_VERSION_BITS_DEPLOYMENTS
26 * Struct for each individual consensus rule change using BIP9.
28 struct BIP9Deployment
{
29 /** Bit position to select the particular bit in nVersion. */
31 /** Start MedianTime for version bits miner confirmation. Can be a date in the past */
33 /** Timeout/expiry MedianTime for the deployment attempt. */
36 /** Constant for nTimeout very far in the future. */
37 static constexpr int64_t NO_TIMEOUT
= std::numeric_limits
<int64_t>::max();
39 /** Special value for nStartTime indicating that the deployment is always active.
40 * This is useful for testing, as it means tests don't need to deal with the activation
41 * process (which takes at least 3 BIP9 intervals). Only tests that specifically test the
42 * behaviour during activation cannot use this. */
43 static constexpr int64_t ALWAYS_ACTIVE
= -1;
47 * Parameters that influence chain consensus.
50 uint256 hashGenesisBlock
;
51 int nSubsidyHalvingInterval
;
52 /** Block height at which BIP16 becomes active */
54 /** Block height and hash at which BIP34 becomes active */
57 /** Block height at which BIP65 becomes active */
59 /** Block height at which BIP66 becomes active */
62 * Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,
63 * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.
64 * Examples: 1916 for 95%, 1512 for testchains.
66 uint32_t nRuleChangeActivationThreshold
;
67 uint32_t nMinerConfirmationWindow
;
68 BIP9Deployment vDeployments
[MAX_VERSION_BITS_DEPLOYMENTS
];
69 /** Proof of work parameters */
71 bool fPowAllowMinDifficultyBlocks
;
72 bool fPowNoRetargeting
;
73 int64_t nPowTargetSpacing
;
74 int64_t nPowTargetTimespan
;
75 int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan
/ nPowTargetSpacing
; }
76 uint256 nMinimumChainWork
;
77 uint256 defaultAssumeValid
;
79 } // namespace Consensus
81 #endif // BITCOIN_CONSENSUS_PARAMS_H