diff --git a/src/consensus/params.h b/src/consensus/params.h index 84aa6a32..5baee1c8 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -45,6 +45,7 @@ struct Params { int64_t nBlockAlgoNormalisedWorkDecayStart1; int64_t nBlockAlgoNormalisedWorkDecayStart2; int64_t nGeoAvgWork_Start; + int64_t nAlgoSwitchBlock1; int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacingV1; } diff --git a/src/primitives/pureheader.cpp b/src/primitives/pureheader.cpp index d0e270cd..adbeeddf 100644 --- a/src/primitives/pureheader.cpp +++ b/src/primitives/pureheader.cpp @@ -13,7 +13,6 @@ #include "crypto/yescrypt.h" #include "hash.h" #include "utilstrencodings.h" -#include "myriad_params.h" uint256 CPureBlockHeader::GetHash() const { @@ -36,17 +35,14 @@ uint256 CPureBlockHeader::GetPoWHash(int algo) const return HashGroestl(BEGIN(nVersion), END(nNonce)); case ALGO_SKEIN: return HashSkein(BEGIN(nVersion), END(nNonce)); - case ALGO_CPU: - if(nTime >= nTimeYescryptStart) - { - uint256 thash; - yescrypt_hash(BEGIN(nVersion), BEGIN(thash)); - return thash; - } - else - { - return HashQubit(BEGIN(nVersion), END(nNonce)); - } + case ALGO_QUBIT: + return HashQubit(BEGIN(nVersion), END(nNonce)); + case ALGO_YESCRYPT: + { + uint256 thash; + yescrypt_hash(BEGIN(nVersion), BEGIN(thash)); + return thash; + } } return GetHash(); } @@ -63,13 +59,15 @@ int GetAlgo(int nVersion) return ALGO_GROESTL; case BLOCK_VERSION_SKEIN: return ALGO_SKEIN; - case BLOCK_VERSION_CPU: - return ALGO_CPU; + case BLOCK_VERSION_QUBIT: + return ALGO_QUBIT; + case BLOCK_VERSION_YESCRYPT: + return ALGO_YESCRYPT; } return ALGO_SHA256D; } -std::string GetAlgoName(int Algo, uint32_t time) +std::string GetAlgoName(int Algo) { switch (Algo) { @@ -81,15 +79,10 @@ std::string GetAlgoName(int Algo, uint32_t time) return std::string("groestl"); case ALGO_SKEIN: return std::string("skein"); - case ALGO_CPU: - if(time >= nTimeYescryptStart) - { - return std::string("yescrypt"); - } - else - { - return std::string("qubit"); - } + case ALGO_QUBIT: + return std::string("qubit"); + case ALGO_YESCRYPT: + return std::string("yescrypt"); } return std::string("unknown"); } \ No newline at end of file diff --git a/src/primitives/pureheader.h b/src/primitives/pureheader.h index ccb6d44d..2e1ac37a 100644 --- a/src/primitives/pureheader.h +++ b/src/primitives/pureheader.h @@ -10,12 +10,15 @@ #include "uint256.h" enum { - ALGO_SHA256D = 0, - ALGO_SCRYPT = 1, - ALGO_GROESTL = 2, - ALGO_SKEIN = 3, - ALGO_CPU = 4, - NUM_ALGOS }; + ALGO_SHA256D = 0, + ALGO_SCRYPT = 1, + ALGO_GROESTL = 2, + ALGO_SKEIN = 3, + ALGO_QUBIT = 4, + ALGO_YESCRYPT = 5, + NUM_ALGOS_IMPL }; + +const int NUM_ALGOS = 5; enum { @@ -27,11 +30,12 @@ enum BLOCK_VERSION_SCRYPT = (1 << 9), BLOCK_VERSION_GROESTL = (2 << 9), BLOCK_VERSION_SKEIN = (3 << 9), - BLOCK_VERSION_CPU = (4 << 9), + BLOCK_VERSION_QUBIT = (4 << 9), + BLOCK_VERSION_YESCRYPT = (5 << 9), }; int GetAlgo(int nVersion); -std::string GetAlgoName(int Algo, uint32_t time); +std::string GetAlgoName(int Algo); /** * Encapsulate a block version. This takes care of building it up @@ -104,8 +108,11 @@ public: case ALGO_SKEIN: nVersion |= BLOCK_VERSION_SKEIN; break; - case ALGO_CPU: - nVersion |= BLOCK_VERSION_CPU; + case ALGO_QUBIT: + nVersion |= BLOCK_VERSION_QUBIT; + break; + case ALGO_YESCRYPT: + nVersion |= BLOCK_VERSION_YESCRYPT; break; default: break;