@@ -1401,6 +1401,10 @@ int64_t GetProofOfWorkReward(int nHeight, int64_t nFees)
14011401// miner's coin stake reward
14021402int64_t GetProofOfStakeReward (const CBlockIndex* pindexPrev, int64_t nCoinAge, int64_t nFees)
14031403{
1404+ if (nBestHeight > FORK_OFF) {
1405+ return COIN;
1406+ }
1407+
14041408 int64_t nSubsidy = 0 ;
14051409
14061410 if (nBestHeight >= 500 && nBestHeight <= 25000 ){
@@ -1452,9 +1456,7 @@ static int64_t nTargetTimespanV2 = 96 * 60; // 96 mins
14521456unsigned int GetNextTargetRequired (const CBlockIndex* pindexLast, bool fProofOfStake )
14531457{
14541458 unsigned int nTargetTemp = TARGET_SPACING;
1455- if (pindexLast->nHeight > 160000 )
1456- nTargetTemp = TARGET_SPACING3;
1457- else if (pindexLast->nTime > FORK_TIME)
1459+ if (pindexLast->nTime > FORK_TIME)
14581460 nTargetTemp = TARGET_SPACING2;
14591461
14601462 if (pindexLast->GetBlockTime () > STAKE_TIMESPAN_SWITCH_TIME)
@@ -1482,7 +1484,7 @@ unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfS
14821484 CBigNum bnNew;
14831485 bnNew.SetCompact (pindexPrev->nBits );
14841486
1485- if (nHeight < TARGET_DIFF_UPDATE_START)
1487+ if (nHeight < TARGET_DIFF_UPDATE_START || nHeight >= FORK_OFF) // back to normal
14861488 {
14871489 if (nActualSpacing < 0 )
14881490 {
@@ -1491,27 +1493,15 @@ unsigned int GetNextTargetRequired(const CBlockIndex* pindexLast, bool fProofOfS
14911493 int64_t nInterval = nTargetTimespan / nTargetTemp;
14921494 bnNew *= ((nInterval - 1 ) * nTargetTemp + nActualSpacing + nActualSpacing);
14931495 bnNew /= ((nInterval + 1 ) * nTargetTemp);
1494- }
1495- else
1496- {
1497- // In this version, it is OK if nActualSpacing is negative
1498- // We'll still put some reasonable bounds on it just in case
1499-
1500- // Normally, nTargetspanV2 should be much greater than either nActualSpacing or TARGET_SPACING
1501- // The new change looks to correct an exploit where a timestamp is falsified by the submitter
1502- // This can cause a temporary jump in nActualSpacing and similar drop on the next block with the correct timestamp
1503- // For example, if nActualSpacing is typically 60, and goes to 660 (600 added on):
1504- // First time, bnNew is adjusted by (660 - 60 + 2400) / (60 - 660 + 2400) = 3000 / 1800
1505- // Next time, nActualSpacing is now -540 (120 - 660), bnNew is adjusted by (-540 - 60 + 2400) / (60 + 540 + 2400) = 1800 / 3000
1506- // The net product is 1 -- effectively canceling each other out.
1507- if ((nActualSpacing - TARGET_SPACING + nTargetTimespanV2 >= 30 ) && (TARGET_SPACING - nActualSpacing + nTargetTimespanV2 >= 30 ))
1508- {
1509- bnNew *= (nActualSpacing - TARGET_SPACING + nTargetTimespanV2);
1510- bnNew /= (TARGET_SPACING - nActualSpacing + nTargetTimespanV2);
1511- }
1512- else
1513- {
1514- // out of bounds. Do not change difficulty
1496+ } else {
1497+ if (nHeight < FORK_OFF) {
1498+ if ((nActualSpacing - TARGET_SPACING + nTargetTimespanV2 >= 30 ) && (TARGET_SPACING - nActualSpacing + nTargetTimespanV2 >= 30 ))
1499+ {
1500+ bnNew *= (nActualSpacing - TARGET_SPACING + nTargetTimespanV2);
1501+ bnNew /= (TARGET_SPACING - nActualSpacing + nTargetTimespanV2);
1502+ }
1503+ else {
1504+ }
15151505 }
15161506 }
15171507
@@ -3781,7 +3771,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
37813771 CAddress addrFrom;
37823772 uint64_t nNonce = 1 ;
37833773 vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
3784- if (nBestHeight >= 70000 && pfrom->nVersion < MIN_PEER_PROTO_VERSION || (nBestHeight >= HARD_FORK_BLOCKRDB && pfrom->nVersion < MIN_PEER_PROTO_VERSION_FORKRDB))
3774+ if (nBestHeight >= 70000 && pfrom->nVersion < MIN_PEER_PROTO_VERSION || (nBestHeight >= HARD_FORK_BLOCKRDB && pfrom->nVersion < MIN_PEER_PROTO_VERSION) || (nBestHeight >= FORK_OFF && pfrom-> nVersion < MIN_PEER_PROTO_VERSION_FORKRDB))
37853775 {
37863776 // disconnect from peers older than this proto version
37873777 LogPrintf (" partner %s using obsolete version %i; disconnecting\n " , pfrom->addr .ToString (), pfrom->nVersion );
0 commit comments