| 113 | }; |
| 114 | |
| 115 | int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev, bool isProofOfStake) |
| 116 | { |
| 117 | int64_t nOldTime = pblock->nTime; |
| 118 | int64_t nNewTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); |
| 119 | |
| 120 | if (nOldTime < nNewTime) |
| 121 | pblock->nTime = nNewTime; |
| 122 | |
| 123 | // Updating time can change work required on testnet: |
| 124 | if (consensusParams.fPowAllowMinDifficultyBlocks) |
| 125 | pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams, isProofOfStake); |
| 126 | |
| 127 | return nNewTime - nOldTime; |
| 128 | } |
| 129 | |
| 130 | BlockAssembler::BlockAssembler(const CChainParams& _chainparams) |
| 131 | : chainParams(_chainparams) |
no test coverage detected