diff options
author | fanquake <fanquake@gmail.com> | 2022-08-22 09:56:23 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-08-22 10:00:46 +0100 |
commit | 0f35f4ddf405196a61bfc0616b82e826f1698862 (patch) | |
tree | f989ddac7885e36409438a096cf95ce787b44bd3 /src/node | |
parent | 027b6729bce7f59a0744e17b210e347a098631ad (diff) | |
parent | eeee5ada23f2a71d245671556b6ecfdaabfeddf4 (diff) |
Merge bitcoin/bitcoin#25786: refactor: Make adjusted time type safe
eeee5ada23f2a71d245671556b6ecfdaabfeddf4 Make adjusted time type safe (MacroFake)
fa3be799fe951a7ea9b4de78d5a907c6db71eeb8 Add time helpers (MacroFake)
Pull request description:
This makes follow-ups easier to review. Also, it makes sense by itself.
ACKs for top commit:
ryanofsky:
Code review ACK eeee5ada23f2a71d245671556b6ecfdaabfeddf4. Confirmed type changes and equivalent code changes only.
Tree-SHA512: 51bf1ae5428552177286113babdd49e82459d6c710a07b6e80a0a045d373cf51045ee010461aba98e0151d8d71b9b3b5f8f73e302d46ba4558e0b55201f99e9f
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/miner.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node/miner.cpp b/src/node/miner.cpp index 9db10feae4..f04742deeb 100644 --- a/src/node/miner.cpp +++ b/src/node/miner.cpp @@ -30,7 +30,7 @@ namespace node { int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) { int64_t nOldTime = pblock->nTime; - int64_t nNewTime = std::max(pindexPrev->GetMedianTimePast() + 1, GetAdjustedTime()); + int64_t nNewTime{std::max<int64_t>(pindexPrev->GetMedianTimePast() + 1, TicksSinceEpoch<std::chrono::seconds>(GetAdjustedTime()))}; if (nOldTime < nNewTime) { pblock->nTime = nNewTime; @@ -133,7 +133,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc pblock->nVersion = gArgs.GetIntArg("-blockversion", pblock->nVersion); } - pblock->nTime = GetAdjustedTime(); + pblock->nTime = TicksSinceEpoch<std::chrono::seconds>(GetAdjustedTime()); m_lock_time_cutoff = pindexPrev->GetMedianTimePast(); int nPackagesSelected = 0; |