Set origtargert

This commit is contained in:
jl777
2019-07-29 08:21:00 -11:00
parent 439fee9bc7
commit 5d19239884
2 changed files with 4 additions and 2 deletions

View File

@@ -1449,13 +1449,14 @@ void static BitcoinMiner_noeq()
}
else if ( ASSETCHAINS_ADAPTIVEPOW != 0 && ASSETCHAINS_STAKED == 0 )
{
arith_uint256 origtarget;
arith_uint256 origtarget; bool fNegative,fOverflow;
uint32_t elapsed = (pblock->nTime - komodo_heightstamp(Mining_height-1));
if ( elapsed > 777 )
{
elapsed -= 777;
origtarget = HASHTarget;
HASHTarget_POW = HASHTarget * arith_uint256(elapsed * elapsed);
if ( bnTarget < origtarget ) // deal with underflow
if ( HASHTarget < origtarget ) // deal with underflow
{
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
fprintf(stderr,"miner underflowed, set to mindiff\n");

View File

@@ -460,6 +460,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
if ( elapsed > 777 )
{
elapsed -= 777;
origtarget = bnTarget;
bnTarget = bnTarget * arith_uint256(elapsed * elapsed);
if ( bnTarget < origtarget ) // deal with underflow
{