MCPcopy Create free account
hub / github.com/LUX-Core/lux / UpdateTime

Function UpdateTime

src/miner.cpp:115–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113};
114
115int64_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
130BlockAssembler::BlockAssembler(const CChainParams& _chainparams)
131 : chainParams(_chainparams)

Callers 3

CreateNewBlockMethod · 0.85
getblocktemplateFunction · 0.85
getworkFunction · 0.85

Calls 4

maxFunction · 0.85
GetAdjustedTimeFunction · 0.85
GetNextWorkRequiredFunction · 0.85
GetMedianTimePastMethod · 0.80

Tested by

no test coverage detected