Mitigation of very long block times, starting 2500 for PoW
This commit is contained in:
@@ -1219,6 +1219,8 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
|
|||||||
vcalc_sha256(0,(uint8_t *)&hash,hashbuf,100 + (int32_t)sizeof(uint256)*2 + sizeof(vout));
|
vcalc_sha256(0,(uint8_t *)&hash,hashbuf,100 + (int32_t)sizeof(uint256)*2 + sizeof(vout));
|
||||||
for (iter=0; iter<180; iter++)
|
for (iter=0; iter<180; iter++)
|
||||||
{
|
{
|
||||||
|
if ( blocktime+iter+segid*2 < txtime+minage )
|
||||||
|
continue;
|
||||||
diff = (iter + blocktime - txtime - minage);
|
diff = (iter + blocktime - txtime - minage);
|
||||||
if ( diff < 0 )
|
if ( diff < 0 )
|
||||||
diff = 60;
|
diff = 60;
|
||||||
@@ -1229,9 +1231,9 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
|
|||||||
}
|
}
|
||||||
if ( iter > 0 )
|
if ( iter > 0 )
|
||||||
diff += segid*2;
|
diff += segid*2;
|
||||||
if ( blocktime+iter+segid*2 < txtime+minage )
|
|
||||||
continue;
|
|
||||||
coinage = (value * diff);
|
coinage = (value * diff);
|
||||||
|
if ( nHeight >= 2500 && blocktime+iter+segid*2 > prevtime+180 )
|
||||||
|
coinage *= ((blocktime+iter+segid*2) - (prevtime+60));
|
||||||
coinage256 = arith_uint256(coinage+1);
|
coinage256 = arith_uint256(coinage+1);
|
||||||
hashval = ratio * (UintToArith256(hash) / coinage256);
|
hashval = ratio * (UintToArith256(hash) / coinage256);
|
||||||
if ( nHeight >= 900 && nHeight < 916 )
|
if ( nHeight >= 900 && nHeight < 916 )
|
||||||
|
|||||||
Reference in New Issue
Block a user