Bitcoin ABC  0.29.2
P2P Digital Currency
activation.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018-2019 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <consensus/activation.h>
6 
7 #include <chain.h>
8 #include <consensus/params.h>
9 #include <util/system.h>
10 
11 bool IsUAHFenabled(const Consensus::Params &params, int nHeight) {
12  return nHeight >= params.uahfHeight;
13 }
14 
15 bool IsUAHFenabled(const Consensus::Params &params,
16  const CBlockIndex *pindexPrev) {
17  if (pindexPrev == nullptr) {
18  return false;
19  }
20 
21  return IsUAHFenabled(params, pindexPrev->nHeight);
22 }
23 
24 bool IsDAAEnabled(const Consensus::Params &params, int nHeight) {
25  return nHeight >= params.daaHeight;
26 }
27 
28 bool IsDAAEnabled(const Consensus::Params &params,
29  const CBlockIndex *pindexPrev) {
30  if (pindexPrev == nullptr) {
31  return false;
32  }
33 
34  return IsDAAEnabled(params, pindexPrev->nHeight);
35 }
36 
38  int32_t nHeight) {
39  return nHeight >= params.magneticAnomalyHeight;
40 }
41 
43  const CBlockIndex *pindexPrev) {
44  if (pindexPrev == nullptr) {
45  return false;
46  }
47 
48  return IsMagneticAnomalyEnabled(params, pindexPrev->nHeight);
49 }
50 
51 static bool IsGravitonEnabled(const Consensus::Params &params,
52  int32_t nHeight) {
53  return nHeight >= params.gravitonHeight;
54 }
55 
57  const CBlockIndex *pindexPrev) {
58  if (pindexPrev == nullptr) {
59  return false;
60  }
61 
62  return IsGravitonEnabled(params, pindexPrev->nHeight);
63 }
64 
65 static bool IsPhononEnabled(const Consensus::Params &params, int32_t nHeight) {
66  return nHeight >= params.phononHeight;
67 }
68 
70  const CBlockIndex *pindexPrev) {
71  if (pindexPrev == nullptr) {
72  return false;
73  }
74 
75  return IsPhononEnabled(params, pindexPrev->nHeight);
76 }
77 
78 static bool IsAxionEnabled(const Consensus::Params &params, int32_t nHeight) {
79  return nHeight >= params.axionHeight;
80 }
81 
82 bool IsAxionEnabled(const Consensus::Params &params,
83  const CBlockIndex *pindexPrev) {
84  if (pindexPrev == nullptr) {
85  return false;
86  }
87 
88  return IsAxionEnabled(params, pindexPrev->nHeight);
89 }
90 
91 bool IsWellingtonEnabled(const Consensus::Params &params, int32_t nHeight) {
92  return nHeight >= params.wellingtonHeight;
93 }
94 
96  const CBlockIndex *pindexPrev) {
97  if (pindexPrev == nullptr) {
98  return false;
99  }
100 
101  return IsWellingtonEnabled(params, pindexPrev->nHeight);
102 }
103 
104 bool IsCowperthwaiteEnabled(const Consensus::Params &params, int32_t nHeight) {
105  return nHeight >= params.cowperthwaiteHeight;
106 }
107 
109  const CBlockIndex *pindexPrev) {
110  if (pindexPrev == nullptr) {
111  return false;
112  }
113 
114  return IsCowperthwaiteEnabled(params, pindexPrev->nHeight);
115 }
116 
118  int64_t nMedianTimePast) {
119  return nMedianTimePast >= gArgs.GetIntArg("-leekuanyewactivationtime",
120  params.leeKuanYewActivationTime);
121 }
122 
124  const CBlockIndex *pindexPrev) {
125  if (pindexPrev == nullptr) {
126  return false;
127  }
128 
129  return IsLeeKuanYewEnabled(params, pindexPrev->GetMedianTimePast());
130 }
bool IsDAAEnabled(const Consensus::Params &params, int nHeight)
Definition: activation.cpp:24
bool IsUAHFenabled(const Consensus::Params &params, int nHeight)
Definition: activation.cpp:11
bool IsWellingtonEnabled(const Consensus::Params &params, int32_t nHeight)
Check if May 15th, 2023 protocol upgrade has activated.
Definition: activation.cpp:91
bool IsCowperthwaiteEnabled(const Consensus::Params &params, int32_t nHeight)
Check if Nov 15th, 2023 protocol upgrade has activated.
Definition: activation.cpp:104
static bool IsPhononEnabled(const Consensus::Params &params, int32_t nHeight)
Definition: activation.cpp:65
static bool IsGravitonEnabled(const Consensus::Params &params, int32_t nHeight)
Definition: activation.cpp:51
static bool IsAxionEnabled(const Consensus::Params &params, int32_t nHeight)
Definition: activation.cpp:78
bool IsMagneticAnomalyEnabled(const Consensus::Params &params, int32_t nHeight)
Check if Nov 15, 2018 HF has activated using block height.
Definition: activation.cpp:37
bool IsLeeKuanYewEnabled(const Consensus::Params &params, int64_t nMedianTimePast)
Check if May 15th, 2024 protocol upgrade has activated.
Definition: activation.cpp:117
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
Definition: system.cpp:635
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:26
int64_t GetMedianTimePast() const
Definition: blockindex.h:190
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition: blockindex.h:39
unsigned int nHeight
Parameters that influence chain consensus.
Definition: params.h:34
int magneticAnomalyHeight
Block height at which the magnetic anomaly activation becomes active.
Definition: params.h:53
int gravitonHeight
Block height at which the graviton activation becomes active.
Definition: params.h:55
int axionHeight
Block height at which the axion activation becomes active.
Definition: params.h:59
int leeKuanYewActivationTime
Unix time used for MTP activation of 15 May 2024 12:00:00 UTC upgrade.
Definition: params.h:65
int wellingtonHeight
Block height at which the wellington activation becomes active.
Definition: params.h:61
int phononHeight
Block height at which the phonon activation becomes active.
Definition: params.h:57
int daaHeight
Block height at which the new DAA becomes active.
Definition: params.h:51
int uahfHeight
Block height at which UAHF kicks in.
Definition: params.h:49
int cowperthwaiteHeight
Block height at which the Cowperthwaite activation becomes active.
Definition: params.h:63
ArgsManager gArgs
Definition: system.cpp:80