aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 14:29:12 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-11-21 14:33:22 +0100
commitf2ada138c28bf6b4f4a668c4ab60b55d124c9823 (patch)
treea8266e2f901e69384ceef9b305d23944e713d599 /src/miner.cpp
parentca6fb4e885c899e297e0a6fa723604a41f199aa6 (diff)
parent092b58d13d658baebbf03a6d5209f368f19e50a8 (diff)
Merge pull request #5170
092b58d CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> GetBlockProof(CBlockIndex) (jtimon) 22c4272 MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h) (jtimon)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index b5bfa9c7be..7c3f885410 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -12,6 +12,7 @@
#include "main.h"
#include "net.h"
#include "pow.h"
+#include "timedata.h"
#include "util.h"
#include "utilmoneystr.h"
#ifdef ENABLE_WALLET
@@ -78,6 +79,15 @@ public:
}
};
+void UpdateTime(CBlockHeader* pblock, const CBlockIndex* pindexPrev)
+{
+ pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
+
+ // Updating time can change work required on testnet:
+ if (Params().AllowMinDifficultyBlocks())
+ pblock->nBits = GetNextWorkRequired(pindexPrev, pblock);
+}
+
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
{
// Create new block