From b9ad319d0095f306bce244220e08e507fba4d94f Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 9 May 2016 22:36:10 +0300 Subject: [PATCH] Unify subsidy formulas for different networks, add few comments --- src/chainparams.cpp | 10 +++++----- src/main.cpp | 29 ----------------------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 625bbe88fa..61e90c5e41 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -72,12 +72,12 @@ class CMainParams : public CChainParams { public: CMainParams() { strNetworkID = "main"; - consensus.nSubsidyHalvingInterval = 210240; + consensus.nSubsidyHalvingInterval = 210240; // Note: actual number of blocks per calendar year with DGW v3 is ~200700 (for example 449750 - 249050) consensus.nMasternodePaymentsStartBlock = 100000; // not true, but it's ok as long as it's less then nMasternodePaymentsIncreaseBlock - consensus.nMasternodePaymentsIncreaseBlock = 158000; - consensus.nMasternodePaymentsIncreasePeriod = 576*30; - consensus.nBudgetPaymentsStartBlock = 328008; - consensus.nBudgetPaymentsCycleBlocks = 16616; + consensus.nMasternodePaymentsIncreaseBlock = 158000; // actual historical value + consensus.nMasternodePaymentsIncreasePeriod = 576*30; // 17280 - actual historical value + consensus.nBudgetPaymentsStartBlock = 328008; // actual historical value + consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725 consensus.nBudgetPaymentsWindowBlocks = 100; consensus.nBudgetProposalEstablishingTime = 60*60*24; consensus.nMajorityEnforceBlockUpgrade = 750; diff --git a/src/main.cpp b/src/main.cpp index 7ea1678e7b..ffae361ef5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1516,35 +1516,6 @@ CAmount GetMasternodePayment(int nHeight, CAmount blockValue) int nMNPIBlock = Params().GetConsensus().nMasternodePaymentsIncreaseBlock; int nMNPIPeriod = Params().GetConsensus().nMasternodePaymentsIncreasePeriod; - // TODO: Remove this to further unify logic among mainnet/testnet/whatevernet, - // use single formula instead (the one that is for current mainnet). - // Will require testnet restart. - if(Params().NetworkIDString() == CBaseChainParams::TESTNET) { - // BUG: there had to be `return` at the end of this `if` but we continued to add mainnet %s, - // TODO: RESTART TESTNET and remove this quick fix - // ret += blockValue * 10 / 20; - // from old testnet code - if(nHeight > 46000) ret += blockValue / 20; //25% - 2014-10-07 - if(nHeight > 46000+((576*1)*1)) ret += blockValue / 20; //30% - 2014-10-08 - if(nHeight > 46000+((576*1)*2)) ret += blockValue / 20; //35% - 2014-10-09 - if(nHeight > 46000+((576*1)*3)) ret += blockValue / 20; //40% - 2014-10-10 - if(nHeight > 46000+((576*1)*4)) ret += blockValue / 20; //45% - 2014-10-11 - if(nHeight > 46000+((576*1)*5)) ret += blockValue / 20; //50% - 2014-10-12 - if(nHeight > 46000+((576*1)*6)) ret += blockValue / 20; //55% - 2014-10-13 - if(nHeight > 46000+((576*1)*7)) ret += blockValue / 20; //60% - 2014-10-14 - //from old mainnet code - if(nHeight > 158000) ret += blockValue / 20; // 158000 - 25.0% - 2014-10-24 - if(nHeight > 158000+((576*30)* 1)) ret += blockValue / 20; // 175280 - 30.0% - 2014-11-25 - if(nHeight > 158000+((576*30)* 2)) ret += blockValue / 20; // 192560 - 35.0% - 2014-12-26 - if(nHeight > 158000+((576*30)* 3)) ret += blockValue / 40; // 209840 - 37.5% - 2015-01-26 - if(nHeight > 158000+((576*30)* 4)) ret += blockValue / 40; // 227120 - 40.0% - 2015-02-27 - if(nHeight > 158000+((576*30)* 5)) ret += blockValue / 40; // 244400 - 42.5% - 2015-03-30 - if(nHeight > 158000+((576*30)* 6)) ret += blockValue / 40; // 261680 - 45.0% - 2015-05-01 - if(nHeight > 158000+((576*30)* 7)) ret += blockValue / 40; // 278960 - 47.5% - 2015-06-01 - if(nHeight > 158000+((576*30)* 9)) ret += blockValue / 40; // 313520 - 50.0% - 2015-08-03 - return ret; - } - // mainnet: if(nHeight > nMNPIBlock) ret += blockValue / 20; // 158000 - 25.0% - 2014-10-24 if(nHeight > nMNPIBlock+(nMNPIPeriod* 1)) ret += blockValue / 20; // 175280 - 30.0% - 2014-11-25