Zawy23
This commit is contained in:
32
src/pow.cpp
32
src/pow.cpp
@@ -168,7 +168,7 @@ arith_uint256 oldRT_CST_RST(int32_t height,uint32_t nTime,arith_uint256 bnTarget
|
||||
arith_uint256 RT_CST_RST_outer(int32_t height,uint32_t nTime,arith_uint256 bnTarget,uint32_t *ts,arith_uint256 *ct,int32_t numerator,int32_t denominator,int32_t W,int32_t past)
|
||||
{
|
||||
int64_t outerK; arith_uint256 mintarget = bnTarget / arith_uint256(2);
|
||||
if ( (ts[0] - ts[W+1]) < (T * numerator)/denominator )
|
||||
if ( (ts[0] - ts[W]) < (T * numerator)/denominator )
|
||||
{
|
||||
outerK = (K * (nTime-ts[0]) * (ts[0]-ts[W]) * denominator) / (numerator * (T * T));
|
||||
if ( outerK < K )
|
||||
@@ -183,7 +183,7 @@ arith_uint256 RT_CST_RST_outer(int32_t height,uint32_t nTime,arith_uint256 bnTar
|
||||
for (z=31; z>=0; z--)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[z]);
|
||||
}
|
||||
fprintf(stderr," ht.%d initial outerK.%lld %d * %d * %d / %d\n",height,(long long)outerK,(nTime-ts[0]),(ts[0]-ts[W]),denominator,numerator);
|
||||
fprintf(stderr," ht.%d initial W.%d outerK.%lld %d * %d * %d / %d\n",height,W,(long long)outerK,(nTime-ts[0]),(ts[0]-ts[W]),denominator,numerator);
|
||||
} //else fprintf(stderr,"ht.%d no outer trigger %d >= %d\n",height,(ts[0] - ts[W]),(T * numerator)/denominator);
|
||||
return(bnTarget);
|
||||
}
|
||||
@@ -322,7 +322,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
|
||||
// Find the first block in the averaging interval
|
||||
const CBlockIndex* pindexFirst = pindexLast;
|
||||
arith_uint256 ct[64],ctinv[64],bnTmp,bnPrev,bnTarget,bnTarget3,bnTarget6,bnTarget12,bnTot {0};
|
||||
arith_uint256 ct[64],ctinv[64],bnTmp,bnPrev,bnTarget,bnTarget2,bnTarget3,bnTarget6,bnTarget12,bnTot {0};
|
||||
uint32_t nbits,blocktime,ts[sizeof(ct)/sizeof(*ct)]; int32_t zflags[sizeof(ct)/sizeof(*ct)],i,diff,height=0,mult = 0,tipdiff = 0;
|
||||
memset(ts,0,sizeof(ts));
|
||||
memset(ct,0,sizeof(ct));
|
||||
@@ -397,24 +397,30 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
origtarget = bnTarget;
|
||||
if ( zflags[0] == 0 || zflags[0] == 3 )
|
||||
{
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,15,100,2,20);
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,1,60,1,10);
|
||||
if ( bnTarget < origtarget )
|
||||
zawyflag = 2;
|
||||
else
|
||||
{
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,1,2,3,30);
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,origtarget,ts,ct,15,100,2,20);
|
||||
if ( bnTarget < origtarget )
|
||||
zawyflag = 2;
|
||||
else
|
||||
{
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,7,3,6,40);
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,origtarget,ts,ct,1,2,3,30);
|
||||
if ( bnTarget < origtarget )
|
||||
zawyflag = 2;
|
||||
else
|
||||
{
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,bnTarget,ts,ct,12,7,12,50);
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,origtarget,ts,ct,7,3,6,40);
|
||||
if ( bnTarget < origtarget )
|
||||
zawyflag = 2;
|
||||
else
|
||||
{
|
||||
bnTarget = RT_CST_RST_outer(height,pblock->nTime,origtarget,ts,ct,12,7,12,50);
|
||||
if ( bnTarget < origtarget )
|
||||
zawyflag = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,8 +430,18 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
for (i=0; i<50; i++)
|
||||
if ( zflags[i] == 2 )
|
||||
break;
|
||||
if ( i < 10 )
|
||||
{
|
||||
bnTarget = RT_CST_RST_inner(height,pblock->nTime,bnTarget,ts,ct,1,i);
|
||||
if ( bnTarget > origtarget )
|
||||
bnTarget = origtarget;
|
||||
}
|
||||
if ( i < 20 )
|
||||
bnTarget = RT_CST_RST_inner(height,pblock->nTime,bnTarget,ts,ct,2,i);
|
||||
{
|
||||
bnTarget2 = RT_CST_RST_inner(height,pblock->nTime,bnTarget,ts,ct,2,i);
|
||||
if ( bnTarget2 < bnTarget )
|
||||
bnTarget = bnTarget2;
|
||||
}
|
||||
if ( i < 30 )
|
||||
{
|
||||
bnTarget3 = RT_CST_RST_inner(height,pblock->nTime,bnTarget,ts,ct,3,i);
|
||||
|
||||
Reference in New Issue
Block a user