diff --git a/configure.ac b/configure.ac index e8979f1e..845238d8 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 9) define(_CLIENT_VERSION_REVISION, 2) -define(_CLIENT_VERSION_BUILD, 9) +define(_CLIENT_VERSION_BUILD, 10) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2014) AC_INIT([Myriadcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitcoin.org],[myriadcoin]) diff --git a/src/clientversion.h b/src/clientversion.h index b6c429ff..6f480d9f 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,7 +12,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_REVISION 2 -#define CLIENT_VERSION_BUILD 9 +#define CLIENT_VERSION_BUILD 10 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/main.h b/src/main.h index 89cab1fc..ec96a0c1 100644 --- a/src/main.h +++ b/src/main.h @@ -689,6 +689,7 @@ enum BlockStatus { const int64_t nBlockAlgoWorkWeightStart = 142000; // block where algo work weighting starts const int64_t nBlockAlgoNormalisedWorkStart = 740000; // block where algo combined weight starts +const int64_t nBlockAlgoNormalisedWorkDecayStart = 866000; // block where weight decay starts const int64_t nBlockSequentialAlgoRuleStart = 740000; // block where sequential algo rule starts const int64_t nBlockSequentialAlgoRuleStart2 = 766000; // block where sequential algo rule starts const int nBlockSequentialAlgoMaxCount = 6; // maximum sequential blocks of same algo @@ -851,6 +852,32 @@ public: return Params().ProofOfWorkLimit(algo); } + CBigNum GetPrevWorkForAlgoWithDecay(int algo) const + { + int nDistance = 0; + CBigNum nWork; + CBlockIndex* pindex = this->pprev; + while (pindex) + { + if (nDistance > 32) + { + return Params().ProofOfWorkLimit(algo); + } + if (pindex->GetAlgo() == algo) + { + CBigNum nWork = pindex->GetBlockWork(); + nWork *= (32 - nDistance); + nWork /= 32; + if (nWork < Params().ProofOfWorkLimit(algo)) + nWork = Params().ProofOfWorkLimit(algo); + return nWork; + } + pindex = pindex->pprev; + nDistance++; + } + return Params().ProofOfWorkLimit(algo); + } + CBigNum GetBlockWork() const { CBigNum bnTarget; @@ -902,7 +929,10 @@ public: { if (algo != nAlgo) { - nBlockWork += GetPrevWorkForAlgo(algo); + if (nHeight >= nBlockAlgoNormalisedWorkDecayStart) + nBlockWork += GetPrevWorkForAlgoWithDecay(algo); + else + nBlockWork += GetPrevWorkForAlgo(algo); } } bnRes = nBlockWork / NUM_ALGOS;