Dispflag for PoW diff
This commit is contained in:
@@ -1284,7 +1284,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
|
|||||||
|
|
||||||
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc)
|
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc)
|
||||||
{
|
{
|
||||||
int32_t oldflag = 0;
|
int32_t oldflag = 0,dispflag = 0;
|
||||||
CBlockIndex *pindex; arith_uint256 easydiff,bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,m,ht,percPoS,diff,val;
|
CBlockIndex *pindex; arith_uint256 easydiff,bnTarget,hashval,sum,ave; bool fNegative,fOverflow; int32_t i,n,m,ht,percPoS,diff,val;
|
||||||
*percPoSp = percPoS = 0;
|
*percPoSp = percPoS = 0;
|
||||||
if ( height <= 10 || (ASSETCHAINS_STAKED == 100 && height <= 100) )
|
if ( height <= 10 || (ASSETCHAINS_STAKED == 100 && height <= 100) )
|
||||||
@@ -1303,23 +1303,23 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
{
|
{
|
||||||
n++;
|
n++;
|
||||||
percPoS++;
|
percPoS++;
|
||||||
if ( ASSETCHAINS_STAKED < 100 )
|
if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 )
|
||||||
fprintf(stderr,"0");
|
fprintf(stderr,"0");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_STAKED < 100 )
|
if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 )
|
||||||
fprintf(stderr,"1");
|
fprintf(stderr,"1");
|
||||||
sum += UintToArith256(pindex->GetBlockHash());
|
sum += UintToArith256(pindex->GetBlockHash());
|
||||||
m++;
|
m++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ASSETCHAINS_STAKED < 100 && (i % 10) == 9 )
|
if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 && (i % 10) == 9 )
|
||||||
fprintf(stderr," %d, ",percPoS);
|
fprintf(stderr," %d, ",percPoS);
|
||||||
}
|
}
|
||||||
if ( m+n < 100 )
|
if ( m+n < 100 )
|
||||||
percPoS = ((percPoS * n) + (goalperc * (100-n))) / 100;
|
percPoS = ((percPoS * n) + (goalperc * (100-n))) / 100;
|
||||||
if ( ASSETCHAINS_STAKED < 100 )
|
if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 )
|
||||||
fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height);
|
fprintf(stderr," -> %d%% percPoS vs goalperc.%d ht.%d\n",percPoS,goalperc,height);
|
||||||
*percPoSp = percPoS;
|
*percPoSp = percPoS;
|
||||||
if ( m > 0 )
|
if ( m > 0 )
|
||||||
@@ -1332,12 +1332,10 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
percPoS = 1;
|
percPoS = 1;
|
||||||
if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget
|
if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget
|
||||||
{
|
{
|
||||||
//if ( oldflag != 0 )
|
|
||||||
// bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256(goalperc * goalperc * goalperc);
|
|
||||||
if ( oldflag != 0 )
|
if ( oldflag != 0 )
|
||||||
bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
||||||
else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
||||||
if ( ASSETCHAINS_STAKED < 100 )
|
if ( dispflag != 0 && ASSETCHAINS_STAKED < 100 )
|
||||||
{
|
{
|
||||||
for (i=31; i>=24; i--)
|
for (i=31; i>=24; i--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
|
||||||
@@ -1355,7 +1353,6 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
if ( oldflag != 0 )
|
if ( oldflag != 0 )
|
||||||
{
|
{
|
||||||
bnTarget = ((ave * arith_uint256(goalperc)) + (easydiff * arith_uint256(percPoS))) / arith_uint256(percPoS + goalperc);
|
bnTarget = ((ave * arith_uint256(goalperc)) + (easydiff * arith_uint256(percPoS))) / arith_uint256(percPoS + goalperc);
|
||||||
//bnTarget = (bnTarget * arith_uint256(percPoS * percPoS * percPoS)) / arith_uint256(goalperc * goalperc);
|
|
||||||
bnTarget = (bnTarget / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
bnTarget = (bnTarget / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
||||||
}
|
}
|
||||||
else bnTarget = (ave / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
else bnTarget = (ave / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
||||||
@@ -1367,7 +1364,7 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
if ( bnTarget < ave )
|
if ( bnTarget < ave )
|
||||||
bnTarget = ave;
|
bnTarget = ave;
|
||||||
}
|
}
|
||||||
if ( 1 )
|
if ( dispflag != 0 )
|
||||||
{
|
{
|
||||||
for (i=31; i>=24; i--)
|
for (i=31; i>=24; i--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user