Algo switch by height, algo added approach, refactorings

This commit is contained in:
8bitcoder
2016-06-19 12:58:29 +02:00
parent 145a74219f
commit f032ddaef1
9 changed files with 48 additions and 117 deletions
+3 -21
View File
@@ -12,7 +12,6 @@
#include "uint256.h"
#include "util.h"
#include "bignum.h"
#include "myriad_params.h"
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params, int algo)
{
@@ -123,24 +122,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
}
}
}
// change of algo from Qubit to Yescrypt
// because the difficulty of qubit will be much higher than yescrypt on change, we will return the proof-of-work limit
// once the changeover occurs, then start adjusting once nAveragingInterval blocks have occured. Will result in a short
// insta-mine, but difficulty changes will quickly take care of this.
if(pindexLast->GetBlockTime() >= nTimeYescryptStart && algo == ALGO_CPU)
{
if(pindexFirst->GetBlockTime() < nTimeYescryptStart)
{
if(fDebug)
{
LogPrintf("nTimeYescryptStart has been passed, but insufficient yescrypt blocks to calculate new target. Returning nProofOfWorkLimit\n");
}
return nProofOfWorkLimit.GetCompact();
}
}
int64_t nActualTimespan;
if (pindexLast->nHeight >= params.nBlockTimeWarpPreventStart3)
@@ -325,7 +307,7 @@ int GetAlgoWorkFactor(int algo)
return 64 * 8;
case ALGO_SKEIN:
return 4 * 6;
case ALGO_CPU:
case ALGO_QUBIT:
return 128 * 8;
default:
return 1;
@@ -427,7 +409,7 @@ arith_uint256 GetGeometricMeanPrevWork(const CBlockIndex& block)
CBigNum bnBlockWork = CBigNum(ArithToUint256(nBlockWork));
int nAlgo = block.GetAlgo();
for (int algo = 0; algo < NUM_ALGOS; algo++)
for (int algo = 0; algo < NUM_ALGOS_IMPL; algo++)
{
if (algo != nAlgo)
{