aboutsummaryrefslogtreecommitdiff
path: root/src/dogecoin.cpp
diff options
context:
space:
mode:
authorRoss Nicoll <[email protected]>2017-09-24 15:56:19 +0100
committerRoss Nicoll <[email protected]>2018-09-19 19:23:29 +0100
commit1de15c70ce8065334fd827b137eba8fb899b527a (patch)
tree1ee5cc2bc768e4d018aebb403e960462d7ce18b6 /src/dogecoin.cpp
parentSync mining code from Namecore to resolve unit test failures (#1385) (diff)
downloaddiscoin-1de15c70ce8065334fd827b137eba8fb899b527a.tar.xz
discoin-1de15c70ce8065334fd827b137eba8fb899b527a.zip
Sync changes from Dogecoin 1.10
Diffstat (limited to 'src/dogecoin.cpp')
-rw-r--r--src/dogecoin.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/dogecoin.cpp b/src/dogecoin.cpp
index 8ac2782ba..76db22f94 100644
--- a/src/dogecoin.cpp
+++ b/src/dogecoin.cpp
@@ -16,6 +16,24 @@ int static generateMTRandom(unsigned int s, int range)
return dist(gen);
}
+// Dogecoin: Normally minimum difficulty blocks can only occur in between
+// retarget blocks. However, once we introduce Digishield every block is
+// a retarget, so we need to handle minimum difficulty on all blocks.
+bool AllowDigishieldMinDifficultyForBlock(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
+{
+ // check if the chain allows minimum difficulty blocks
+ if (!params.fPowAllowMinDifficultyBlocks)
+ return false;
+
+ // check if the chain allows minimum difficulty blocks on recalc blocks
+ if (pindexLast->nHeight < 157500)
+ // if (!params.fPowAllowDigishieldMinDifficultyBlocks)
+ return false;
+
+ // Allow for a minimum block time if the elapsed time > 2*nTargetSpacing
+ return (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2);
+}
+
unsigned int CalculateDogecoinNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
{
int nHeight = pindexLast->nHeight + 1;
@@ -88,8 +106,7 @@ bool CheckAuxPowProofOfWork(const CBlockHeader& block, const Consensus::Params&
params.nAuxpowChainId, block.nVersion);
/* If there is no auxpow, just check the block hash. */
- if (!block.auxpow)
- {
+ if (!block.auxpow) {
if (block.IsAuxpow())
return error("%s : no auxpow on block with auxpow version",
__func__);