Updating code
reviving this project
This commit is contained in:
+5
-4
@@ -2,6 +2,7 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Copyright (c) 2014-2015 The Dash developers
|
||||
// Copyright (c) 2015-2018 The PIVX developers
|
||||
// Copyright (c) 2026 Agrarian Developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -33,7 +34,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
uint256 PastDifficultyAverage;
|
||||
uint256 PastDifficultyAveragePrev;
|
||||
|
||||
if (BlockLastSolved == NULL || BlockLastSolved->nHeight == 0 || BlockLastSolved->nHeight < PastBlocksMin) {
|
||||
if (BlockLastSolved == nullptr || BlockLastSolved->nHeight == 0 || BlockLastSolved->nHeight < PastBlocksMin) {
|
||||
return Params().ProofOfWorkLimit().GetCompact();
|
||||
}
|
||||
|
||||
@@ -74,7 +75,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
if (CountBlocks == 1) {
|
||||
PastDifficultyAverage.SetCompact(BlockReading->nBits);
|
||||
} else {
|
||||
PastDifficultyAverage = ((PastDifficultyAveragePrev * CountBlocks) + (uint256().SetCompact(BlockReading->nBits))) / (CountBlocks + 1);
|
||||
PastDifficultyAverage = ((PastDifficultyAveragePrev* CountBlocks) + (uint256().SetCompact(BlockReading->nBits))) / (CountBlocks + 1);
|
||||
}
|
||||
PastDifficultyAveragePrev = PastDifficultyAverage;
|
||||
}
|
||||
@@ -85,7 +86,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
}
|
||||
LastBlockTime = BlockReading->GetBlockTime();
|
||||
|
||||
if (BlockReading->pprev == NULL) {
|
||||
if (BlockReading->pprev == nullptr) {
|
||||
assert(BlockReading);
|
||||
break;
|
||||
}
|
||||
@@ -94,7 +95,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
|
||||
uint256 bnNew(PastDifficultyAverage);
|
||||
|
||||
int64_t _nTargetTimespan = CountBlocks * Params().TargetSpacing();
|
||||
int64_t _nTargetTimespan = CountBlocks* Params().TargetSpacing();
|
||||
|
||||
if (nActualTimespan < _nTargetTimespan / 3)
|
||||
nActualTimespan = _nTargetTimespan / 3;
|
||||
|
||||
Reference in New Issue
Block a user