Use tipdiff also
This commit is contained in:
@@ -82,7 +82,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
||||
{
|
||||
ASSETCHAINS_ADAPTIVEPOW = 1;
|
||||
fprintf(stderr,"default activate adaptivepow\n");
|
||||
} else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,1564499104-365*2*1440)
|
||||
} else fprintf(stderr,"height1 time %u vs %u\n",pindex->nTime,1564499104-365*2*1440);
|
||||
} else fprintf(stderr,"cant find height 1\n");
|
||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||
komodo_pricesinit();
|
||||
|
||||
@@ -1418,10 +1418,13 @@ uint32_t komodo_stakehash(uint256 *hashp,char *address,uint8_t *hashbuf,uint256
|
||||
|
||||
arith_uint256 komodo_adaptivepow_target(int32_t height,arith_uint256 bnTarget,uint32_t nTime)
|
||||
{
|
||||
arith_uint256 origtarget,easy; int32_t diff; int64_t mult; bool fNegative,fOverflow; CBlockIndex *tipindex;
|
||||
arith_uint256 origtarget,easy; int32_t diff,tipdiff; int64_t mult; bool fNegative,fOverflow; CBlockIndex *tipindex;
|
||||
if ( height > 10 && (tipindex= komodo_chainactive(height - 1)) != 0 )
|
||||
{
|
||||
diff = (nTime - tipindex->GetMedianTimePast());
|
||||
tipdiff = (nTime - tipindex->nTime);
|
||||
if ( tipdiff > 13*ASSETCHAINS_BLOCKTIME )
|
||||
diff = 13*ASSETCHAINS_BLOCKTIME;
|
||||
if ( diff > 20 * ASSETCHAINS_BLOCKTIME )
|
||||
{
|
||||
mult = diff - 19 * ASSETCHAINS_BLOCKTIME;
|
||||
|
||||
Reference in New Issue
Block a user