From d5750228f1ad2a2b9422411b462c1b00da35402b Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 7 Aug 2019 20:12:52 -1100 Subject: [PATCH] Set past --- src/pow.cpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index ead3ec965..87f629029 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -403,12 +403,14 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead zawyflag = 2; else { - bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,7,3,6,50); + past += 10; + bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,7,3,6,past); if ( bnTarget < origtarget ) zawyflag = 2; else { - bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,12,7,12,50); + past += 10; + bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,12,7,12,past); if ( bnTarget < origtarget ) zawyflag = 2; } @@ -416,35 +418,23 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead } else { - for (i=0; inTime,bnTarget,ts,ct,3,i); + bnTarget6 = RT_CST_RST_inner(height,pblock->nTime,bnTarget,ts,ct,6,i); + bnTarget12 = RT_CST_RST_inner(height,pblock->nTime,bnTarget,ts,ct,12,i); + if ( bnTarget6 < bnTarget12 ) + bnTmp = bnTarget6; + else bnTmp = bnTarget12; + if ( bnTmp < bnTarget ) + bnTarget = bnTmp; if ( bnTarget != origtarget ) zawyflag = 1; } } - /* - // bnTarget = RT_CST_RST (height,nTime,bnTarget, ts, cw, numerator, denominator, W, T, past); - bnTarget = RT_CST_RST(height,pblock->nTime,bnTarget,ts,ct,1,2,3,20); - if ( 0 ) - { - bnTarget6 = RT_CST_RST(height,pblock->nTime,bnTarget,ts,ct,7,3,6,50); - bnTarget12 = RT_CST_RST(height,pblock->nTime,bnTarget,ts,ct,12,7,12,50); - if ( bnTarget6 < bnTarget12 ) - bnTmp = bnTarget6; - else bnTmp = bnTarget12; - if ( bnTmp < bnTarget ) - bnTarget = bnTmp; - }*/ - bnTarget = (bnTarget + ct[0]) / arith_uint256(2); - if ( bnTarget > origtarget ) - { - bnTarget = origtarget; - zawyflag = 0; - } } if ( mult > 1 ) // e^mult case, jl777: test of mult > 1 failed when it was int64_t??? { @@ -464,7 +454,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead fprintf(stderr," exp() to the rescue cmp.%d mult.%d for ht.%d\n",mult>1,(int32_t)mult,height); } if ( zawyflag == 0 && mult <= 1 ) - bnTarget = zawy_TSA_EMA(height,tipdiff,bnTarget,ts[0] - ts[1]); + bnTarget = zawy_TSA_EMA(height,tipdiff,ct[0],ts[0] - ts[1]); } nbits = bnTarget.GetCompact(); nbits = (nbits & 0xfffffffc) | zawyflag;