Bitcoin ABC  0.22.12
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 static 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 static 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 bool IsAxionEnabled(const Consensus::Params &params,
79  const CBlockIndex *pindexPrev) {
80  if (pindexPrev == nullptr) {
81  return false;
82  }
83 
84  return pindexPrev->GetMedianTimePast() >=
85  gArgs.GetArg("-axionactivationtime", params.axionActivationTime);
86 }
int uahfHeight
Block height at which UAHF kicks in.
Definition: params.h:74
bool IsAxionEnabled(const Consensus::Params &params, const CBlockIndex *pindexPrev)
Check if November 15th, 2020 protocol upgrade has activated.
Definition: activation.cpp:78
unsigned int nHeight
static bool IsDAAEnabled(const Consensus::Params &params, int nHeight)
Definition: activation.cpp:24
int daaHeight
Block height at which the new DAA becomes active.
Definition: params.h:76
int phononHeight
Block height at which the phonon activation becomes active.
Definition: params.h:82
static bool IsGravitonEnabled(const Consensus::Params &params, int32_t nHeight)
Definition: activation.cpp:51
int gravitonHeight
Block height at which the graviton activation becomes active.
Definition: params.h:80
int axionActivationTime
Unix time used for MTP activation of 15 Nov 2020 12:00:00 UTC upgrade.
Definition: params.h:84
Parameters that influence chain consensus.
Definition: params.h:59
static bool IsPhononEnabled(const Consensus::Params &params, int32_t nHeight)
Definition: activation.cpp:65
int64_t GetMedianTimePast() const
Definition: blockindex.h:172
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: blockindex.h:23
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
Definition: system.cpp:479
ArgsManager gArgs
Definition: system.cpp:76
static bool IsUAHFenabled(const Consensus::Params &params, int nHeight)
Definition: activation.cpp:11
int magneticAnomalyHeight
Block height at which the magnetic anomaly activation becomes active.
Definition: params.h:78
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition: blockindex.h:36
bool IsMagneticAnomalyEnabled(const Consensus::Params &params, int32_t nHeight)
Check if Nov 15, 2018 HF has activated using block height.
Definition: activation.cpp:37