MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / UpdateTime

Function UpdateTime

src/miner.cpp:40–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38uint64_t nLastBlockWeight = 0;
39
40int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
41{
42 int64_t nOldTime = pblock->nTime;
43 int64_t nNewTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
44
45 if (nOldTime < nNewTime)
46 pblock->nTime = nNewTime;
47
48 // Updating time can change work required on testnet:
49 if (consensusParams.fPowAllowMinDifficultyBlocks)
50 pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, consensusParams);
51
52 return nNewTime - nOldTime;
53}
54
55BlockAssembler::Options::Options() {
56 blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE);

Callers 2

CreateNewBlockMethod · 0.85
getblocktemplateFunction · 0.85

Calls 4

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

Tested by

no test coverage detected