Recall hashtarget

This commit is contained in:
jl777
2019-07-30 06:55:35 -11:00
parent 9496986ca9
commit 1aab146063
3 changed files with 8 additions and 4 deletions

View File

@@ -83,7 +83,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
ASSETCHAINS_ADAPTIVEPOW = 1; ASSETCHAINS_ADAPTIVEPOW = 1;
fprintf(stderr,"default activate adaptivepow\n"); fprintf(stderr,"default activate adaptivepow\n");
} else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON); } else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,ADAPTIVEPOW_CHANGETO_DEFAULTON);
} else fprintf(stderr,"cant find height 1\n"); } //else fprintf(stderr,"cant find height 1\n");
if ( ASSETCHAINS_CBOPRET != 0 ) if ( ASSETCHAINS_CBOPRET != 0 )
komodo_pricesinit(); komodo_pricesinit();
while (!fShutdown) while (!fShutdown)

View File

@@ -1435,10 +1435,10 @@ arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,ui
if ( bnTarget < origtarget || bnTarget > easy ) // deal with overflow if ( bnTarget < origtarget || bnTarget > easy ) // deal with overflow
{ {
bnTarget = easy; bnTarget = easy;
fprintf(stderr,"height.%d miner overflowed mult.%lld, set to mindiff\n",height,(long long)mult); fprintf(stderr,"tipdiff.%d diff.%d height.%d miner overflowed mult.%lld, set to mindiff\n",tippdiff,diff,height,(long long)mult);
} else fprintf(stderr,"height.%d miner elapsed %d, adjust by factor of %lld\n",height,diff,(long long)mult); } else fprintf(stderr,"tipdiff.%d diff.%d height.%d miner elapsed %d, adjust by factor of %lld\n",tipdiff,diff,height,diff,(long long)mult);
} else fprintf(stderr,"height.%d tipdiff.%d diff %d, vs %d\n",height,tipdiff,diff,13*ASSETCHAINS_BLOCKTIME); } else fprintf(stderr,"height.%d tipdiff.%d diff %d, vs %d\n",height,tipdiff,diff,13*ASSETCHAINS_BLOCKTIME);
} // else fprintf(stderr,"cant find height.%d\n",height); } else fprintf(stderr,"adaptive cant find height.%d\n",height);
return(bnTarget); return(bnTarget);
} }

View File

@@ -2041,7 +2041,11 @@ void static BitcoinMiner()
pblock->nNonce = ArithToUint256(UintToArith256(pblock->nNonce) + 1); pblock->nNonce = ArithToUint256(UintToArith256(pblock->nNonce) + 1);
pblock->nBits = savebits; pblock->nBits = savebits;
if ( ASSETCHAINS_ADAPTIVEPOW > 0 ) if ( ASSETCHAINS_ADAPTIVEPOW > 0 )
{
fprintf(stderr,"update time in miner\n");
UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev); UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
hashtarget = komodo_adaptivepow_target(Mining_height,HASHTarget,pblock->nTime);
}
/*if ( NOTARY_PUBKEY33[0] == 0 ) /*if ( NOTARY_PUBKEY33[0] == 0 )
{ {
int32_t percPoS; int32_t percPoS;