]>
Commit | Line | Data |
---|---|---|
bd006110 JT |
1 | // Copyright (c) 2009-2010 Satoshi Nakamoto |
2 | // Copyright (c) 2009-2014 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 | ||
a21df620 PK |
6 | #ifndef BITCOIN_CONSENSUS_PARAMS_H |
7 | #define BITCOIN_CONSENSUS_PARAMS_H | |
bd006110 | 8 | |
bd006110 JT |
9 | #include "uint256.h" |
10 | ||
11 | namespace Consensus { | |
12 | /** | |
13 | * Parameters that influence chain consensus. | |
14 | */ | |
15 | struct Params { | |
16 | uint256 hashGenesisBlock; | |
c0dde76d | 17 | |
a180d0a6 | 18 | bool fCoinbaseMustBeProtected; |
c0dde76d | 19 | |
bcb34c08 JG |
20 | /** Needs to evenly divide MAX_SUBSIDY to avoid rounding errors. */ |
21 | int nSubsidySlowStartInterval; | |
22 | /** | |
23 | * Shift based on a linear ramp for slow start: | |
24 | * | |
068e2f1a JG |
25 | * MAX_SUBSIDY*(t_s/2 + t_r) = MAX_SUBSIDY*t_h Coin balance |
26 | * t_s + t_r = t_h + t_c Block balance | |
bcb34c08 JG |
27 | * |
28 | * t_s = nSubsidySlowStartInterval | |
29 | * t_r = number of blocks between end of slow start and first halving | |
30 | * t_h = nSubsidyHalvingInterval | |
31 | * t_c = SubsidySlowStartShift() | |
32 | */ | |
33 | int SubsidySlowStartShift() const { return nSubsidySlowStartInterval / 2; } | |
bd006110 | 34 | int nSubsidyHalvingInterval; |
db0f9315 S |
35 | int GetLastFoundersRewardBlockHeight() const { |
36 | return nSubsidyHalvingInterval + SubsidySlowStartShift() - 1; | |
37 | } | |
bd006110 JT |
38 | /** Used to check majorities for block version upgrade */ |
39 | int nMajorityEnforceBlockUpgrade; | |
40 | int nMajorityRejectBlockOutdated; | |
41 | int nMajorityWindow; | |
42 | /** Proof of work parameters */ | |
fd311996 | 43 | uint256 powLimit; |
bd006110 | 44 | bool fPowAllowMinDifficultyBlocks; |
f2c48e15 JG |
45 | int64_t nPowAveragingWindow; |
46 | int64_t nPowMaxAdjustDown; | |
47 | int64_t nPowMaxAdjustUp; | |
bd006110 | 48 | int64_t nPowTargetSpacing; |
f2c48e15 JG |
49 | int64_t AveragingWindowTimespan() const { return nPowAveragingWindow * nPowTargetSpacing; } |
50 | int64_t MinActualTimespan() const { return (AveragingWindowTimespan() * (100 - nPowMaxAdjustUp )) / 100; } | |
51 | int64_t MaxActualTimespan() const { return (AveragingWindowTimespan() * (100 + nPowMaxAdjustDown)) / 100; } | |
bd006110 JT |
52 | }; |
53 | } // namespace Consensus | |
54 | ||
a21df620 | 55 | #endif // BITCOIN_CONSENSUS_PARAMS_H |