| 40 | } |
| 41 | |
| 42 | int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) |
| 43 | { |
| 44 | int64_t nOldTime = pblock->nTime; |
| 45 | int64_t nNewTime = std::max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime()); |
| 46 | |
| 47 | if (nOldTime < nNewTime) { |
| 48 | pblock->nTime = nNewTime; |
| 49 | } |
| 50 | |
| 51 | // Updating time can change work required on testnet: |
| 52 | if (consensusParams.fPowAllowMinDifficultyBlocks) { |
| 53 | pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams); |
| 54 | } |
| 55 | |
| 56 | return nNewTime - nOldTime; |
| 57 | } |
| 58 | |
| 59 | void RegenerateCommitments(CBlock& block, ChainstateManager& chainman) |
| 60 | { |
no test coverage detected