From e3fb0ff772e7d3bc5632ce6785263ddcf13a3a31 Mon Sep 17 00:00:00 2001 From: myriadcoin Date: Sun, 12 Jul 2015 16:12:59 +0200 Subject: [PATCH] GetBlockWorkAdjusted fix --- src/main.cpp | 6 ++++-- src/main.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 80dcf5d2..481e0f0a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1732,8 +1732,8 @@ void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev) block.nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); // Updating time can change work required on testnet: - if (TestNet()) - block.nBits = GetNextWorkRequired(pindexPrev, &block, block.GetAlgo()); + //if (TestNet()) + // block.nBits = GetNextWorkRequired(pindexPrev, &block, block.GetAlgo()); } @@ -2668,6 +2668,8 @@ bool CheckBlock(const CBlock& block, CValidationState& state, int nHeight, bool bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp) { + LogPrintf("AcceptBlock: BlockTime=%d\n", block.nTime); + AssertLockHeld(cs_main); // Check for duplicate uint256 hash = block.GetHash(); diff --git a/src/main.h b/src/main.h index d38c7ea2..4e296e50 100644 --- a/src/main.h +++ b/src/main.h @@ -964,7 +964,7 @@ public: CBigNum GetBlockWorkAdjusted() const { CBigNum bnRes; - if ((TestNet() && (nHeight > 500)) || + if ((TestNet() && (nHeight > 50)) || (nHeight >= GeoAvgWork_Start)) { CBigNum nBlockWork = GetBlockWork(); @@ -978,6 +978,7 @@ public: nBlockWork *= nBlockWorkAlt; } } + bnRes = nBlockWork; // Compute the geometric mean bnRes = bnRes.nthRoot(NUM_ALGOS); // Scale to roughly match the old work calculation