mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-10-17 05:41:34 +02:00
GetBlockWorkAdjusted fix
This commit is contained in:
+4
-2
@@ -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();
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user