Fix PoS PoW diff

This commit is contained in:
jl777
2018-06-01 06:05:23 -11:00
parent 2515c9f22a
commit e83bf6b3cb
2 changed files with 5 additions and 2 deletions

View File

@@ -1154,6 +1154,8 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
for (i=n=0; i<100; i++) for (i=n=0; i<100; i++)
{ {
ht = height - 100 + i; ht = height - 100 + i;
if ( ht <= 1 )
continue;
if ( (pindex= komodo_chainactive(ht)) != 0 ) if ( (pindex= komodo_chainactive(ht)) != 0 )
{ {
bnTarget.SetCompact(pindex->nBits,&fNegative,&fOverflow); bnTarget.SetCompact(pindex->nBits,&fNegative,&fOverflow);
@@ -1341,7 +1343,8 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
{ {
if ( slowflag != 0 ) if ( slowflag != 0 )
bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED);
else bnTarget = (bnTarget / arith_uint256(KOMODO_POWMINMULT)); // lower bound else if ( height > 100 )
bnTarget = (bnTarget / arith_uint256(KOMODO_POWMINMULT)); // lower bound
if ( bhash > bnTarget ) if ( bhash > bnTarget )
{ {
for (i=31; i>=16; i--) for (i=31; i>=16; i--)

View File

@@ -4273,7 +4273,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
if ( checked != 0 && komodo_checkPOW(from_miner && ASSETCHAINS_STAKED == 0,pblock,height) < 0 ) if ( checked != 0 && komodo_checkPOW(from_miner && ASSETCHAINS_STAKED == 0,pblock,height) < 0 )
{ {
checked = 0; checked = 0;
fprintf(stderr,"passed checkblock but failed checkPOW.%d\n",from_miner && ASSETCHAINS_STAKED == 0); //fprintf(stderr,"passed checkblock but failed checkPOW.%d\n",from_miner && ASSETCHAINS_STAKED == 0);
} }
if (!checked && futureblock == 0) if (!checked && futureblock == 0)
{ {