Bitcoin Core  22.99.0
P2P Digital Currency
params.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2020 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 <limits>
11 
12 namespace Consensus {
13 
18 enum BuriedDeployment : int16_t {
19  // buried deployments get negative values to avoid overlap with DeploymentPos
20  DEPLOYMENT_HEIGHTINCB = std::numeric_limits<int16_t>::min(),
25 };
26 constexpr bool ValidDeployment(BuriedDeployment dep) { return DEPLOYMENT_HEIGHTINCB <= dep && dep <= DEPLOYMENT_SEGWIT; }
27 
28 enum DeploymentPos : uint16_t {
30  DEPLOYMENT_TAPROOT, // Deployment of Schnorr/Taproot (BIPs 340-342)
31  // NOTE: Also add new deployments to VersionBitsDeploymentInfo in deploymentinfo.cpp
33 };
34 constexpr bool ValidDeployment(DeploymentPos dep) { return DEPLOYMENT_TESTDUMMY <= dep && dep <= DEPLOYMENT_TAPROOT; }
35 
41  int bit;
43  int64_t nStartTime;
45  int64_t nTimeout;
51 
53  static constexpr int64_t NO_TIMEOUT = std::numeric_limits<int64_t>::max();
54 
59  static constexpr int64_t ALWAYS_ACTIVE = -1;
60 
64  static constexpr int64_t NEVER_ACTIVE = -2;
65 };
66 
70 struct Params {
73  /* Block hash that is excepted from BIP16 enforcement */
83  int CSVHeight;
110 
115  bool signet_blocks{false};
116  std::vector<uint8_t> signet_challenge;
117 
119  {
120  switch (dep) {
122  return BIP34Height;
123  case DEPLOYMENT_CLTV:
124  return BIP65Height;
125  case DEPLOYMENT_DERSIG:
126  return BIP66Height;
127  case DEPLOYMENT_CSV:
128  return CSVHeight;
129  case DEPLOYMENT_SEGWIT:
130  return SegwitHeight;
131  } // no default case, so the compiler can warn about missing cases
132  return std::numeric_limits<int>::max();
133  }
134 };
135 
136 } // namespace Consensus
137 
138 #endif // BITCOIN_CONSENSUS_PARAMS_H
Consensus::BIP9Deployment::nStartTime
int64_t nStartTime
Start MedianTime for version bits miner confirmation.
Definition: params.h:43
Consensus::BIP9Deployment::bit
int bit
Bit position to select the particular bit in nVersion.
Definition: params.h:41
Consensus::MAX_VERSION_BITS_DEPLOYMENTS
@ MAX_VERSION_BITS_DEPLOYMENTS
Definition: params.h:32
Consensus::Params::nSubsidyHalvingInterval
int nSubsidyHalvingInterval
Definition: params.h:72
Consensus::DEPLOYMENT_HEIGHTINCB
@ DEPLOYMENT_HEIGHTINCB
Definition: params.h:20
uint256.h
Consensus::BIP9Deployment::nTimeout
int64_t nTimeout
Timeout/expiry MedianTime for the deployment attempt.
Definition: params.h:45
Consensus::BIP9Deployment::NO_TIMEOUT
static constexpr int64_t NO_TIMEOUT
Constant for nTimeout very far in the future.
Definition: params.h:53
Consensus::Params::nMinerConfirmationWindow
uint32_t nMinerConfirmationWindow
Definition: params.h:97
Consensus::Params::defaultAssumeValid
uint256 defaultAssumeValid
By default assume that the signatures in ancestors of this block are valid.
Definition: params.h:109
Consensus::Params::nRuleChangeActivationThreshold
uint32_t nRuleChangeActivationThreshold
Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,...
Definition: params.h:96
Consensus::DEPLOYMENT_CLTV
@ DEPLOYMENT_CLTV
Definition: params.h:21
Consensus::BIP9Deployment
Struct for each individual consensus rule change using BIP9.
Definition: params.h:39
Consensus::Params::nPowTargetSpacing
int64_t nPowTargetSpacing
Definition: params.h:103
Consensus::Params
Parameters that influence chain consensus.
Definition: params.h:70
Consensus::Params::SegwitHeight
int SegwitHeight
Block height at which Segwit (BIP141, BIP143 and BIP147) becomes active.
Definition: params.h:87
Consensus::DeploymentPos
DeploymentPos
Definition: params.h:28
Consensus::DEPLOYMENT_SEGWIT
@ DEPLOYMENT_SEGWIT
Definition: params.h:24
Consensus
Transaction validation functions.
Definition: params.h:12
Consensus::Params::fPowAllowMinDifficultyBlocks
bool fPowAllowMinDifficultyBlocks
Definition: params.h:101
Consensus::ValidDeployment
constexpr bool ValidDeployment(BuriedDeployment dep)
Definition: params.h:26
Consensus::Params::signet_challenge
std::vector< uint8_t > signet_challenge
Definition: params.h:116
Consensus::BIP9Deployment::NEVER_ACTIVE
static constexpr int64_t NEVER_ACTIVE
Special value for nStartTime indicating that the deployment is never active.
Definition: params.h:64
Consensus::DEPLOYMENT_TAPROOT
@ DEPLOYMENT_TAPROOT
Definition: params.h:30
uint256
256-bit opaque blob.
Definition: uint256.h:124
Consensus::Params::powLimit
uint256 powLimit
Proof of work parameters.
Definition: params.h:100
Consensus::DEPLOYMENT_TESTDUMMY
@ DEPLOYMENT_TESTDUMMY
Definition: params.h:29
Consensus::Params::BIP34Hash
uint256 BIP34Hash
Definition: params.h:77
Consensus::Params::fPowNoRetargeting
bool fPowNoRetargeting
Definition: params.h:102
Consensus::Params::nPowTargetTimespan
int64_t nPowTargetTimespan
Definition: params.h:104
Consensus::BIP9Deployment::min_activation_height
int min_activation_height
If lock in occurs, delay activation until at least this block height.
Definition: params.h:50
Consensus::DEPLOYMENT_DERSIG
@ DEPLOYMENT_DERSIG
Definition: params.h:22
Consensus::Params::BIP34Height
int BIP34Height
Block height and hash at which BIP34 becomes active.
Definition: params.h:76
Consensus::Params::BIP66Height
int BIP66Height
Block height at which BIP66 becomes active.
Definition: params.h:81
Consensus::Params::hashGenesisBlock
uint256 hashGenesisBlock
Definition: params.h:71
Consensus::Params::vDeployments
BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS]
Definition: params.h:98
Consensus::Params::DeploymentHeight
int DeploymentHeight(BuriedDeployment dep) const
Definition: params.h:118
Consensus::BuriedDeployment
BuriedDeployment
A buried deployment is one where the height of the activation has been hardcoded into the client impl...
Definition: params.h:18
Consensus::DEPLOYMENT_CSV
@ DEPLOYMENT_CSV
Definition: params.h:23
Consensus::Params::BIP65Height
int BIP65Height
Block height at which BIP65 becomes active.
Definition: params.h:79
Consensus::Params::nMinimumChainWork
uint256 nMinimumChainWork
The best chain should have at least this much work.
Definition: params.h:107
Consensus::Params::CSVHeight
int CSVHeight
Block height at which CSV (BIP68, BIP112 and BIP113) becomes active.
Definition: params.h:83
Consensus::Params::BIP16Exception
uint256 BIP16Exception
Definition: params.h:74
Consensus::Params::DifficultyAdjustmentInterval
int64_t DifficultyAdjustmentInterval() const
Definition: params.h:105
Consensus::Params::MinBIP9WarningHeight
int MinBIP9WarningHeight
Don't warn about unknown BIP 9 activations below this height.
Definition: params.h:90
Consensus::Params::signet_blocks
bool signet_blocks
If true, witness commitments contain a payload equal to a Bitcoin Script solution to the signet chall...
Definition: params.h:115
Consensus::BIP9Deployment::ALWAYS_ACTIVE
static constexpr int64_t ALWAYS_ACTIVE
Special value for nStartTime indicating that the deployment is always active.
Definition: params.h:59