forked from Bitcoin-ABC/bitcoin-abc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.h
108 lines (95 loc) · 3.45 KB
/
params.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CONSENSUS_PARAMS_H
#define BITCOIN_CONSENSUS_PARAMS_H
#include <primitives/blockhash.h>
#include <uint256.h>
#include <chrono>
#include <limits>
namespace Consensus {
enum BuriedDeployment : int16_t {
// buried deployments get negative values to avoid overlap with
// DeploymentPos
DEPLOYMENT_P2SH = std::numeric_limits<int16_t>::min(),
DEPLOYMENT_HEIGHTINCB,
DEPLOYMENT_CLTV,
DEPLOYMENT_DERSIG,
DEPLOYMENT_CSV,
};
constexpr bool ValidDeployment(BuriedDeployment dep) {
return dep <= DEPLOYMENT_CSV;
}
/**
* Parameters that influence chain consensus.
*/
struct Params {
BlockHash hashGenesisBlock;
int nSubsidyHalvingInterval;
/** Block height at which BIP16 becomes active */
int BIP16Height;
/** Block height and hash at which BIP34 becomes active */
int BIP34Height;
BlockHash BIP34Hash;
/** Block height at which BIP65 becomes active */
int BIP65Height;
/** Block height at which BIP66 becomes active */
int BIP66Height;
/** Block height at which CSV (BIP68, BIP112 and BIP113) becomes active */
int CSVHeight;
/** Block height at which UAHF kicks in */
int uahfHeight;
/** Block height at which the new DAA becomes active */
int daaHeight;
/** Block height at which the magnetic anomaly activation becomes active */
int magneticAnomalyHeight;
/** Block height at which the graviton activation becomes active */
int gravitonHeight;
/** Block height at which the phonon activation becomes active */
int phononHeight;
/** Block height at which the axion activation becomes active */
int axionHeight;
/** Block height at which the wellington activation becomes active */
int wellingtonHeight;
/** Block height at which the Cowperthwaite activation becomes active */
int cowperthwaiteHeight;
/** Unix time used for MTP activation of 15 May 2024 12:00:00 UTC upgrade */
int leeKuanYewActivationTime;
/** Enable or disable the miner fund by default */
bool enableMinerFund;
/** Enable or disable the staking rewards by default */
bool enableStakingRewards;
/** Proof of work parameters */
uint256 powLimit;
bool fPowAllowMinDifficultyBlocks;
bool fPowNoRetargeting;
int64_t nDAAHalfLife;
int64_t nPowTargetSpacing;
int64_t nPowTargetTimespan;
std::chrono::seconds PowTargetSpacing() const {
return std::chrono::seconds{nPowTargetSpacing};
}
int64_t DifficultyAdjustmentInterval() const {
return nPowTargetTimespan / nPowTargetSpacing;
}
uint256 nMinimumChainWork;
BlockHash defaultAssumeValid;
int DeploymentHeight(BuriedDeployment dep) const {
switch (dep) {
case DEPLOYMENT_P2SH:
return BIP16Height;
case DEPLOYMENT_HEIGHTINCB:
return BIP34Height;
case DEPLOYMENT_CLTV:
return BIP65Height;
case DEPLOYMENT_DERSIG:
return BIP66Height;
case DEPLOYMENT_CSV:
return CSVHeight;
} // no default case, so the compiler can warn about missing cases
return std::numeric_limits<int>::max();
}
};
} // namespace Consensus
#endif // BITCOIN_CONSENSUS_PARAMS_H