@@ -1527,61 +1527,55 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params&
15271527 // LogPrintf("height %u diff %4.2f reward %i \n", nPrevHeight, dDiff, nSubsidy);
15281528 nSubsidy *= COIN;
15291529
1530+ // TODO: Remove this to further unify logic among mainnet/testnet/whatevernet,
1531+ // use single formula instead (the one that is for current mainnet).
1532+ // Probably a good idea to use a significally lower consensusParams.nSubsidyHalvingInterval
1533+ // for testnet (like 10 times for example) to see the effect of halving there faster.
1534+ // Will require testnet restart.
15301535 if (Params ().NetworkIDString () == CBaseChainParams::TESTNET){
15311536 for (int i = 46200 ; i <= nPrevHeight; i += consensusParams.nSubsidyHalvingInterval ) nSubsidy -= nSubsidy/14 ;
15321537 } else {
15331538 // yearly decline of production by 7.1% per year, projected 21.3M coins max by year 2050.
15341539 for (int i = consensusParams.nSubsidyHalvingInterval ; i <= nPrevHeight; i += consensusParams.nSubsidyHalvingInterval ) nSubsidy -= nSubsidy/14 ;
15351540 }
15361541
1537- /*
1538-
1539- Hard fork will activate on block 328008, reducing the block reward by 10 extra percent (allowing budget super-blocks)
1540-
1541- */
1542+ // Hard fork to reduce the block reward by 10 extra percent (allowing budget super-blocks)
1543+ if (nPrevHeight > consensusParams.nBudgetPaymentsStartBlock ) nSubsidy -= nSubsidy/10 ;
15421544
1543- if (Params ().NetworkIDString () == CBaseChainParams::TESTNET){
1544- if (nPrevHeight > 77900 +576 ) nSubsidy -= nSubsidy/10 ;
1545- } else {
1546- if (nPrevHeight > 309759 +(553 *33 )) nSubsidy -= nSubsidy/10 ; // 328008 - 10.0% - 2015-08-30
1547- }
1548-
15491545 return nSubsidy;
15501546}
15511547
15521548CAmount GetMasternodePayment (int nHeight, CAmount blockValue)
15531549{
15541550 CAmount ret = blockValue/5 ; // start at 20%
15551551
1556- if (Params ().NetworkIDString () == CBaseChainParams::TESTNET) {
1557- if (nHeight > 46000 ) ret += blockValue / 20 ; // 25% - 2014-10-07
1558- if (nHeight > 46000 +((576 *1 )*1 )) ret += blockValue / 20 ; // 30% - 2014-10-08
1559- if (nHeight > 46000 +((576 *1 )*2 )) ret += blockValue / 20 ; // 35% - 2014-10-09
1560- if (nHeight > 46000 +((576 *1 )*3 )) ret += blockValue / 20 ; // 40% - 2014-10-10
1561- if (nHeight > 46000 +((576 *1 )*4 )) ret += blockValue / 20 ; // 45% - 2014-10-11
1562- if (nHeight > 46000 +((576 *1 )*5 )) ret += blockValue / 20 ; // 50% - 2014-10-12
1563- if (nHeight > 46000 +((576 *1 )*6 )) ret += blockValue / 20 ; // 55% - 2014-10-13
1564- if (nHeight > 46000 +((576 *1 )*7 )) ret += blockValue / 20 ; // 60% - 2014-10-14
1565- }
1566-
1567- if (nHeight > 158000 ) ret += blockValue / 20 ; // 158000 - 25.0% - 2014-10-24
1568- if (nHeight > 158000 +((576 *30 )* 1 )) ret += blockValue / 20 ; // 175280 - 30.0% - 2014-11-25
1569- if (nHeight > 158000 +((576 *30 )* 2 )) ret += blockValue / 20 ; // 192560 - 35.0% - 2014-12-26
1570- if (nHeight > 158000 +((576 *30 )* 3 )) ret += blockValue / 40 ; // 209840 - 37.5% - 2015-01-26
1571- if (nHeight > 158000 +((576 *30 )* 4 )) ret += blockValue / 40 ; // 227120 - 40.0% - 2015-02-27
1572- if (nHeight > 158000 +((576 *30 )* 5 )) ret += blockValue / 40 ; // 244400 - 42.5% - 2015-03-30
1573- if (nHeight > 158000 +((576 *30 )* 6 )) ret += blockValue / 40 ; // 261680 - 45.0% - 2015-05-01
1574- if (nHeight > 158000 +((576 *30 )* 7 )) ret += blockValue / 40 ; // 278960 - 47.5% - 2015-06-01
1575- if (nHeight > 158000 +((576 *30 )* 9 )) ret += blockValue / 40 ; // 313520 - 50.0% - 2015-08-03
1576-
1577- /*
1578- Hard for will activate on block 348080 separating the two networks (v11 and earier and v12)
1552+ int nMNPIBlock = Params ().GetConsensus ().nMasternodePaymentsIncreaseBlock ;
1553+ int nMNPIPeriod = Params ().GetConsensus ().nMasternodePaymentsIncreasePeriod ;
15791554
1580- if(nHeight > 158000+((576*30)*11)) ret += blockValue / 40; // 348080 - 52.5% - 2015-10-05
1581- if(nHeight > 158000+((576*30)*13)) ret += blockValue / 40; // 382640 - 55.0% - 2015-12-07
1582- if(nHeight > 158000+((576*30)*15)) ret += blockValue / 40; // 417200 - 57.5% - 2016-02-08
1583- if(nHeight > 158000+((576*30)*17)) ret += blockValue / 40; // 451760 - 60.0% - 2016-04-11
1584- */
1555+ // TODO: Remove this to further unify logic among mainnet/testnet/whatevernet,
1556+ // use single formula instead (the one that is for current mainnet).
1557+ // Will require testnet restart.
1558+ if (Params ().NetworkIDString () == CBaseChainParams::TESTNET) {
1559+ if (nHeight > nMNPIBlock) ret += blockValue / 20 ; // 25% - 2014-10-07
1560+ if (nHeight > nMNPIBlock+(nMNPIPeriod*1 )) ret += blockValue / 20 ; // 30% - 2014-10-08
1561+ if (nHeight > nMNPIBlock+(nMNPIPeriod*2 )) ret += blockValue / 20 ; // 35% - 2014-10-09
1562+ if (nHeight > nMNPIBlock+(nMNPIPeriod*3 )) ret += blockValue / 20 ; // 40% - 2014-10-10
1563+ if (nHeight > nMNPIBlock+(nMNPIPeriod*4 )) ret += blockValue / 20 ; // 45% - 2014-10-11
1564+ if (nHeight > nMNPIBlock+(nMNPIPeriod*5 )) ret += blockValue / 20 ; // 50% - 2014-10-12
1565+ if (nHeight > nMNPIBlock+(nMNPIPeriod*6 )) ret += blockValue / 20 ; // 55% - 2014-10-13
1566+ if (nHeight > nMNPIBlock+(nMNPIPeriod*7 )) ret += blockValue / 20 ; // 60% - 2014-10-14
1567+ }
1568+
1569+ // mainnet:
1570+ if (nHeight > nMNPIBlock) ret += blockValue / 20 ; // 158000 - 25.0% - 2014-10-24
1571+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 1 )) ret += blockValue / 20 ; // 175280 - 30.0% - 2014-11-25
1572+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 2 )) ret += blockValue / 20 ; // 192560 - 35.0% - 2014-12-26
1573+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 3 )) ret += blockValue / 40 ; // 209840 - 37.5% - 2015-01-26
1574+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 4 )) ret += blockValue / 40 ; // 227120 - 40.0% - 2015-02-27
1575+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 5 )) ret += blockValue / 40 ; // 244400 - 42.5% - 2015-03-30
1576+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 6 )) ret += blockValue / 40 ; // 261680 - 45.0% - 2015-05-01
1577+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 7 )) ret += blockValue / 40 ; // 278960 - 47.5% - 2015-06-01
1578+ if (nHeight > nMNPIBlock+(nMNPIPeriod* 9 )) ret += blockValue / 40 ; // 313520 - 50.0% - 2015-08-03
15851579
15861580 return ret;
15871581}
@@ -3298,25 +3292,19 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
32983292 const Consensus::Params& consensusParams = Params ().GetConsensus ();
32993293 int nHeight = pindexPrev->nHeight + 1 ;
33003294 // Check proof of work
3301- if (Params ().NetworkIDString () == CBaseChainParams::TESTNET) {
3295+ if (Params ().NetworkIDString () == CBaseChainParams::MAIN && nHeight <= 68589 ){
3296+ // architecture issues with DGW v1 and v2)
3297+ unsigned int nBitsNext = GetNextWorkRequired (pindexPrev, &block, consensusParams);
3298+ double n1 = ConvertBitsToDouble (block.nBits );
3299+ double n2 = ConvertBitsToDouble (nBitsNext);
3300+
3301+ if (abs (n1-n2) > n1*0.5 )
3302+ return state.DoS (100 , error (" %s : incorrect proof of work (DGW pre-fork) - %f %f %f at %d" , __func__, abs (n1-n2), n1, n2, nHeight),
3303+ REJECT_INVALID, " bad-diffbits" );
3304+ } else {
33023305 if (block.nBits != GetNextWorkRequired (pindexPrev, &block, consensusParams))
33033306 return state.DoS (100 , error (" %s : incorrect proof of work at %d" , __func__, nHeight),
3304- REJECT_INVALID, " bad-diffbits" );
3305- } else {
3306- // Check proof of work (Here for the architecture issues with DGW v1 and v2)
3307- if (nHeight <= 68589 ){
3308- unsigned int nBitsNext = GetNextWorkRequired (pindexPrev, &block, consensusParams);
3309- double n1 = ConvertBitsToDouble (block.nBits );
3310- double n2 = ConvertBitsToDouble (nBitsNext);
3311-
3312- if (abs (n1-n2) > n1*0.5 )
3313- return state.DoS (100 , error (" %s : incorrect proof of work (DGW pre-fork) - %f %f %f at %d" , __func__, abs (n1-n2), n1, n2, nHeight),
3314- REJECT_INVALID, " bad-diffbits" );
3315- } else {
3316- if (block.nBits != GetNextWorkRequired (pindexPrev, &block, consensusParams))
3317- return state.DoS (100 , error (" %s : incorrect proof of work at %d" , __func__, nHeight),
3318- REJECT_INVALID, " bad-diffbits" );
3319- }
3307+ REJECT_INVALID, " bad-diffbits" );
33203308 }
33213309
33223310 // Check timestamp against prev
0 commit comments