Browse Source

7250 diff cap.16 hardfork for PoS

pull/4/head
jl777 6 years ago
parent
commit
2ba9de01cb
  1. 11
      src/komodo_bitcoind.h
  2. 11
      src/miner.cpp
  3. 15
      src/pow.cpp

11
src/komodo_bitcoind.h

@ -1159,6 +1159,13 @@ uint32_t komodo_newstake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHe
}
if ( nHeight < 4400 ) // POSTEST64 change newstake to stake and stake to oldstake and remove
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
else if ( nHeight >= 7250 )
{
bnMaxPoSdiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
bnMaxPoSdiff = (bnMaxPoSdiff / arith_uint256(16));
if ( bnTarget < bnMaxPoSdiff )
bnTarget = bnMaxPoSdiff;
}
mfactor = 1024;
if ( (minage= nHeight*3) > 6000 ) // about 100 blocks
minage = 6000;
@ -1491,8 +1498,8 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
{
if ( KOMODO_TEST_ASSETCHAIN_SKIP_POW )
return(0);
//fprintf(stderr,"pow violation and no chance it is notary ht.%d %s\n",height,hash.ToString().c_str());
return(-1);
if ( ASSETCHAINS_STAKED == 0 ) // komodo_is_PoSblock will check bnTarget
return(-1);
}
}
if ( ASSETCHAINS_STAKED != 0 && height >= 2 ) // must PoS or have at least 16x better PoW

11
src/miner.cpp

@ -856,7 +856,7 @@ void static BitcoinMiner()
//
// Search
//
uint8_t pubkeys[66][33]; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime();
uint8_t pubkeys[66][33]; arith_uint256 bnMaxPoSdiff; uint32_t blocktimes[66]; int mids[256],nonzpkeys,i,j,externalflag; uint32_t savebits; int64_t nStart = GetTime();
savebits = pblock->nBits;
HASHTarget = arith_uint256().SetCompact(pblock->nBits);
roundrobin_delay = ROUNDROBIN_DELAY;
@ -911,10 +911,17 @@ void static BitcoinMiner()
} //else fprintf(stderr,"duplicate at j.%d\n",j);
} else Mining_start = 0;
} else Mining_start = 0;
if ( ASSETCHAINS_STAKED != 0 && GetArg("-genproclimit", 0) == 0 )
if ( ASSETCHAINS_STAKED != 0 )
{
int32_t percPoS,z;
HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
if ( Mining_height >= 7250 )
{
bnMaxPoSdiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
bnMaxPoSdiff = (bnMaxPoSdiff / arith_uint256(16));
if ( HASHtarget < bnMaxPoSdiff )
HASHtarget = bnMaxPoSdiff;
}
if ( ASSETCHAINS_STAKED < 100 )
{
for (z=31; z>=0; z--)

15
src/pow.cpp

@ -190,8 +190,19 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int
}
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
return error("CheckProofOfWork(): nBits below minimum work");
if ( ASSETCHAINS_STAKED != 0 && height >= 4200 && height < 4400 ) // POSTEST64 remove this
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
if ( ASSETCHAINS_STAKED != 0 )
{
if ( height >= 4200 && height < 4400 )
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
else if ( height >= 7250 )
{
arith_uint256 bnMaxPoSdiff;
bnMaxPoSdiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
bnMaxPoSdiff = (bnMaxPoSdiff / arith_uint256(16));
if ( bnTarget < bnMaxPoSdiff )
bnTarget = bnMaxPoSdiff;
}
}
// Check proof of work matches claimed amount
if ( UintToArith256(hash) > bnTarget )
{

Loading…
Cancel
Save