diff options
author | jtimon <jtimon@blockstream.io> | 2014-10-22 01:31:01 +0200 |
---|---|---|
committer | jtimon <jtimon@blockstream.io> | 2014-10-29 21:00:05 +0100 |
commit | 22c4272bf4ea04689fc0ea08e637caa46ba12c98 (patch) | |
tree | d3df14ade9168c18687d9a769ba62c328611ad6f /src/miner.cpp | |
parent | 723c7526368badda15df8ac1ffc047a0ab2e384a (diff) |
MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r-- | src/miner.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/miner.cpp b/src/miner.cpp index 0235de3ab3..d3bbc6235e 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 |