From 2be772d85d6b16b732ab7db343d3f3fc9df1bb5d Mon Sep 17 00:00:00 2001 From: myriadcoin Date: Tue, 14 Jul 2015 19:30:00 +0200 Subject: [PATCH] Phase 2 timespan --- src/core.h | 2 +- src/main.cpp | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/core.h b/src/core.h index e93144f7..e44ea383 100644 --- a/src/core.h +++ b/src/core.h @@ -46,7 +46,7 @@ static const int AUXPOW_CHAIN_ID = 0x005A; static const int AUXPOW_START_MAINNET = 9999999; //TODO change me static const int AUXPOW_START_TESTNET = 1; -static const int Phase2Reward_Start = 9999999; +static const int Phase2Timespan_Start = 9999999; static const int GeoAvgWork_Start = 9999999; inline int GetAlgo(int nVersion) diff --git a/src/main.cpp b/src/main.cpp index 481e0f0a..5e5adbcf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1256,21 +1256,20 @@ const CBlockIndex* GetLastBlockIndexForAlgo(const CBlockIndex* pindex, int algo) static const int64_t nStartSubsidy = 1000 * COIN; static const int64_t nMinSubsidy = 1 * COIN; -static const int64_t nRewardPhase2StartSubsidy = 50 * COIN; int64_t GetBlockValue(int nHeight, int64_t nFees) { - int64_t nSubsidy; + int64_t nSubsidy = nStartSubsidy; - if (!TestNet() && (nHeight < Phase2Reward_Start)) + // Mining phase: Subsidy is cut in half every SubsidyHalvingInterval + nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval()); + + // Inflation phase: Subsidy reaches minimum subsidy + // Network is rewarded for transaction processing with transaction fees and + // the inflationary subsidy + if (nSubsidy < nMinSubsidy) { - nSubsidy = nStartSubsidy; - nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval()); - } - else - { - nSubsidy = nRewardPhase2StartSubsidy; - nSubsidy += (nHeight / Params().SubsidyHalvingInterval()); + nSubsidy = nMinSubsidy; } return nSubsidy + nFees; @@ -1461,7 +1460,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead } int64_t lnMinActualTimespan; - if (TestNet() || (pindexLast->nHeight >= Phase2Reward_Start)) + if (TestNet() || (pindexLast->nHeight >= Phase2Timespan_Start)) lnMinActualTimespan = nMinActualTimespanP2; else if (pindexLast->nHeight >= nBlockDiffAdjustV2) @@ -1470,7 +1469,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead lnMinActualTimespan = nMinActualTimespanV1; int64_t lnMaxActualTimespan; - if (TestNet() || (pindexLast->nHeight >= Phase2Reward_Start)) + if (TestNet() || (pindexLast->nHeight >= Phase2Timespan_Start)) lnMaxActualTimespan = nMaxActualTimespanP2; else lnMaxActualTimespan = nMaxActualTimespanP1; @@ -1482,7 +1481,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead LogPrintf(" nActualTimespan = %d after bounds %d %d\n", nActualTimespan, lnMinActualTimespan, lnMaxActualTimespan); int64_t lnAveragingTargetTimespan; - if (TestNet() || (pindexLast->nHeight >= Phase2Reward_Start)) + if (TestNet() || (pindexLast->nHeight >= Phase2Timespan_Start)) lnAveragingTargetTimespan = nAveragingTargetTimespanP2; else lnAveragingTargetTimespan = nAveragingTargetTimespanP1;