Skip to content

Commit

Permalink
Revert "[subsidies] Move to a %n reduction every k blocks emission mo…
Browse files Browse the repository at this point in the history
…del"

This reverts commit 0a9fac8.
  • Loading branch information
giaki3003 committed Apr 29, 2020
1 parent c5fce63 commit 8662e9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 37 deletions.
4 changes: 0 additions & 4 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ class CMainParams : public CChainParams

nStartDevfeeBlock = 828100; //Starting block

/** Subsidy reudction vars */

nStartSubsidyReductionBlock = 1125000; //Starting block

/**
* The message start string is designed to be unlikely to occur in normal data.
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
Expand Down
4 changes: 0 additions & 4 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ class CChainParams
/** Devfee vars */
int StartDevfeeBlock() const { return nStartDevfeeBlock; }

/** Devfee vars */
int StartSubsidyReductionBlock() const { return nStartSubsidyReductionBlock; }

protected:
CChainParams() {}

Expand Down Expand Up @@ -162,7 +159,6 @@ class CChainParams
int nPreminePaymentandHardForkBlock;
uint64_t nPruneAfterHeight;
int nStartDevfeeBlock;
int nStartSubsidyReductionBlock;
};

/**
Expand Down
35 changes: 6 additions & 29 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1936,15 +1936,7 @@ uint256 GetProofOfStakeLimit(int nHeight)

CAmount GetProofOfWorkReward(int64_t nFees, int nHeight)
{
CAmount nSubsidy = 8 * COIN;

/** Subsidy reduction stuff */
int nCalcHeight = 0; // Height on which we're going to be calculating
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 nIsReductionHeight = 0; // Remainder check to make sure we're ready for a subsidy reduction
int nBlocksBetweenReductions = 125000; // Number of blocks between which we reduce subsidies

CAmount nSubsidy = 1 * COIN;
const CChainParams& chainParams = Params();

if (Params().NetworkID() == CBaseChainParams::TESTNET) {
Expand All @@ -1968,14 +1960,10 @@ CAmount GetProofOfWorkReward(int64_t nFees, int nHeight)
nSubsidy = 1000 * COIN;
} else if (nHeight >= 500 && nHeight < chainParams.StartDevfeeBlock()) {
nSubsidy = 10 * COIN;
} else if (nHeight >= chainParams.StartDevfeeBlock() && nHeight < chainParams.StartSubsidyReductionBlock()) {
} else if (nHeight >= chainParams.StartDevfeeBlock() && nHeight < 6000000) {
nSubsidy = 8 * COIN;
} else {
nCalcHeight = nHeight - nHeightDelta;
nTimesToReduce = (int)nCalcHeight / nBlocksBetweenReductions;
for (int i = 0; i <= nTimesToReduce; ++i) {
nSubsidy -= (nSubsidy / 100) * 1;
}
nSubsidy = 1 * COIN;
}

if (nHeight < LAST_HEIGHT_FEE_BLOCK) {
Expand All @@ -1989,29 +1977,18 @@ CAmount GetProofOfWorkReward(int64_t nFees, int nHeight)

CAmount GetProofOfStakeReward(int64_t nFees, int nHeight)
{
CAmount nSubsidy = 1.5 * COIN;
CAmount nSubsidy = STATIC_POS_REWARD;
const CChainParams& chainParams = Params();

/** Subsidy reduction stuff */
int nCalcHeight = 0; // Height on which we're going to be calculating
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 nIsReductionHeight = 0; // Remainder check to make sure we're ready for a subsidy reduction
int nBlocksBetweenReductions = 125000; // Number of blocks between which we reduce subsidies

// First 100,000 blocks double stake for masternode ready
if (nHeight < 100000) {
nSubsidy = 2 * COIN;
} else if (nHeight >= 100000 && nHeight < chainParams.StartDevfeeBlock()) {
nSubsidy = 1 * COIN;
} else if (nHeight >= chainParams.StartDevfeeBlock() && nHeight < chainParams.StartSubsidyReductionBlock()) {
} else if (nHeight >= chainParams.StartDevfeeBlock() && nHeight < 6000000) {
nSubsidy = 1.5 * COIN;
} else {
nCalcHeight = nHeight - nHeightDelta;
nTimesToReduce = (int)nCalcHeight / nBlocksBetweenReductions;
for (int i = 0; i <= nTimesToReduce; ++i) {
nSubsidy -= (nSubsidy / 100) * 1;
}
nSubsidy = 1 * COIN;
}

return nSubsidy + nFees;
Expand Down

0 comments on commit 8662e9b

Please sign in to comment.