Set origtargert
This commit is contained in:
@@ -1449,13 +1449,14 @@ void static BitcoinMiner_noeq()
|
|||||||
}
|
}
|
||||||
else if ( ASSETCHAINS_ADAPTIVEPOW != 0 && ASSETCHAINS_STAKED == 0 )
|
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));
|
uint32_t elapsed = (pblock->nTime - komodo_heightstamp(Mining_height-1));
|
||||||
if ( elapsed > 777 )
|
if ( elapsed > 777 )
|
||||||
{
|
{
|
||||||
elapsed -= 777;
|
elapsed -= 777;
|
||||||
|
origtarget = HASHTarget;
|
||||||
HASHTarget_POW = HASHTarget * arith_uint256(elapsed * elapsed);
|
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);
|
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
||||||
fprintf(stderr,"miner underflowed, set to mindiff\n");
|
fprintf(stderr,"miner underflowed, set to mindiff\n");
|
||||||
|
|||||||
@@ -460,6 +460,7 @@ bool CheckProofOfWork(const CBlockHeader &blkHeader, uint8_t *pubkey33, int32_t
|
|||||||
if ( elapsed > 777 )
|
if ( elapsed > 777 )
|
||||||
{
|
{
|
||||||
elapsed -= 777;
|
elapsed -= 777;
|
||||||
|
origtarget = bnTarget;
|
||||||
bnTarget = bnTarget * arith_uint256(elapsed * elapsed);
|
bnTarget = bnTarget * arith_uint256(elapsed * elapsed);
|
||||||
if ( bnTarget < origtarget ) // deal with underflow
|
if ( bnTarget < origtarget ) // deal with underflow
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user