PIVX Core  5.6.99
P2P Digital Currency
upgrades.h
Go to the documentation of this file.
1 // Copyright (c) 2018 The Zcash developers
2 // Copyright (c) 2020 The PIVX 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 PIVX_CONSENSUS_UPGRADES_H
7 #define PIVX_CONSENSUS_UPGRADES_H
8 
9 #include "consensus/params.h"
10 #include "optional.h"
11 
16 };
17 
18 struct NUInfo {
20  std::string strName;
22  std::string strInfo;
23 };
24 
25 extern const struct NUInfo NetworkUpgradeInfo[];
26 
32  int nHeight,
33  const Consensus::Params& params,
35 
42  int nHeight,
43  const Consensus::Params& params,
45 
52 int CurrentEpoch(int nHeight, const Consensus::Params& params);
53 
59  int nHeight,
60  const Consensus::Params& params,
61  Consensus::UpgradeIndex upgrade);
62 
67  int nHeight,
68  const Consensus::Params& params);
69 
74 Optional<int> NextEpoch(int nHeight, const Consensus::Params& params);
75 
81  int nHeight,
82  const Consensus::Params& params);
83 
84 #endif // PIVX_CONSENSUS_UPGRADES_H
UpgradeIndex
Index into Params.vUpgrades and NetworkUpgradeInfo.
Definition: params.h:26
boost::optional< T > Optional
Substitute for C++17 std::optional.
Definition: optional.h:12
Parameters that influence chain consensus.
Definition: params.h:171
std::string strName
User-facing name for the upgrade.
Definition: upgrades.h:20
std::string strInfo
User-facing information string about the upgrade.
Definition: upgrades.h:22
bool NetworkUpgradeActive(int nHeight, const Consensus::Params &params, Consensus::UpgradeIndex idx)
Returns true if the given network upgrade is active as of the given block height.
Definition: upgrades.cpp:107
UpgradeState NetworkUpgradeState(int nHeight, const Consensus::Params &params, Consensus::UpgradeIndex idx)
Checks the state of a given network upgrade based on block height.
Definition: upgrades.cpp:82
int CurrentEpoch(int nHeight, const Consensus::Params &params)
Returns the index of the most recent upgrade as of the given block height (corresponding to the curre...
Definition: upgrades.cpp:115
bool IsActivationHeight(int nHeight, const Consensus::Params &params, Consensus::UpgradeIndex upgrade)
Returns true if the given block height is the activation height for the given upgrade.
Definition: upgrades.cpp:124
bool IsActivationHeightForAnyUpgrade(int nHeight, const Consensus::Params &params)
Returns true if the given block height is the activation height for any upgrade.
Definition: upgrades.cpp:139
Optional< int > NextEpoch(int nHeight, const Consensus::Params &params)
Returns the index of the next upgrade after the given block height, or nullopt if there are no more k...
Definition: upgrades.cpp:155
Optional< int > NextActivationHeight(int nHeight, const Consensus::Params &params)
Returns the activation height for the next upgrade after the given block height, or nullopt if there ...
Definition: upgrades.cpp:170
UpgradeState
Definition: upgrades.h:12
@ UPGRADE_PENDING
Definition: upgrades.h:14
@ UPGRADE_DISABLED
Definition: upgrades.h:13
@ UPGRADE_ACTIVE
Definition: upgrades.h:15
const struct NUInfo NetworkUpgradeInfo[]
General information about each network upgrade.
Definition: upgrades.cpp:15