| 68 | } |
| 69 | |
| 70 | int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) |
| 71 | { |
| 72 | int64_t nOldTime = pblock->nTime; |
| 73 | int64_t nNewTime{std::max<int64_t>(GetMinimumTime(pindexPrev, consensusParams.DifficultyAdjustmentInterval()), |
| 74 | TicksSinceEpoch<std::chrono::seconds>(NodeClock::now()))}; |
| 75 | |
| 76 | if (nOldTime < nNewTime) { |
| 77 | pblock->nTime = nNewTime; |
| 78 | } |
| 79 | |
| 80 | // Updating time can change work required on testnet: |
| 81 | if (consensusParams.fPowAllowMinDifficultyBlocks) { |
| 82 | pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams); |
| 83 | } |
| 84 | |
| 85 | return nNewTime - nOldTime; |
| 86 | } |
| 87 | |
| 88 | void RegenerateCommitments(CBlock& block, ChainstateManager& chainman) |
| 89 | { |
no test coverage detected