Skip to content

Commit

Permalink
Revert "[misc] Corrected a few typos, moved most subsidy vars to chai…
Browse files Browse the repository at this point in the history
…nparams"

This reverts commit 4046ed0.
  • Loading branch information
giaki3003 committed Apr 29, 2020
1 parent ac31f03 commit 29384c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ class CMainParams : public CChainParams

nStartDevfeeBlock = 828100; //Starting block

/** Subsidy reduction vars */
/** Subsidy reudction vars */

nStartSubsidyReductionBlock = 1125000; //Starting height (blocks)
nHeightDelta = 1000000; // Delta when calculating subsidy reductions (blocks)
nBlocksBetweenReductions = nStartSubsidyReductionBlock - nHeightDelta; // Interval between subsidy reductions (blocks)
nStartSubsidyReductionBlock = 1125000; //Starting block

/**
* The message start string is designed to be unlikely to occur in normal data.
Expand Down
6 changes: 1 addition & 5 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ class CChainParams
/** Devfee vars */
int StartDevfeeBlock() const { return nStartDevfeeBlock; }

/** Subsidy reduction vars */
/** Devfee vars */
int StartSubsidyReductionBlock() const { return nStartSubsidyReductionBlock; }
int HeightDelta() const { return nHeightDelta; }
int BlocksBetweenReductions() const { return nBlocksBetweenReductions; }

protected:
CChainParams() {}
Expand Down Expand Up @@ -164,8 +162,6 @@ class CChainParams
uint64_t nPruneAfterHeight;
int nStartDevfeeBlock;
int nStartSubsidyReductionBlock;
int nHeightDelta;
int nBlocksBetweenReductions;
};

/**
Expand Down
10 changes: 6 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1938,9 +1938,11 @@ CAmount GetProofOfWorkReward(int64_t nFees, int nHeight)
{
CAmount nSubsidy = 8 * COIN;

/** Local subsidy reduction stuff (stuff we calculate on) */
/** Subsidy reduction stuff */
int nCalcHeight = 0; // Height on which we're going to be calculating
int nTimesToReduce = 0; // Var for storing the total times when need to reduce the subsidy
int nHeightDelta = 1000000; // Delta when calculating subsidy redeuctions
int nTimesToReduce = 0; // Var which will store the total times when need to reduce the subsidy
int nBlocksBetweenReductions = 125000; // Number of blocks between which we reduce subsidies

const CChainParams& chainParams = Params();

Expand Down Expand Up @@ -1968,8 +1970,8 @@ CAmount GetProofOfWorkReward(int64_t nFees, int nHeight)
} else if (nHeight >= chainParams.StartDevfeeBlock() && nHeight < chainParams.StartSubsidyReductionBlock()) {
nSubsidy = 8 * COIN;
} else {
nCalcHeight = nHeight - chainParams.HeightDelta();
nTimesToReduce = (int)nCalcHeight / chainParams.BlocksBetweenReductions();
nCalcHeight = nHeight - nHeightDelta;
nTimesToReduce = (int)nCalcHeight / nBlocksBetweenReductions;
for (int i = 0; i <= nTimesToReduce; ++i) {
nSubsidy -= (nSubsidy / 100) * 1;
}
Expand Down

0 comments on commit 29384c6

Please sign in to comment.