diff options
author | MacroFake <falke.marco@gmail.com> | 2022-08-05 15:12:58 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-08-05 14:59:15 +0200 |
commit | eeee5ada23f2a71d245671556b6ecfdaabfeddf4 (patch) | |
tree | 3b2c3c56611816254a8a80eb2defca00d3421fde /src/node/miner.cpp | |
parent | fa3be799fe951a7ea9b4de78d5a907c6db71eeb8 (diff) | |
download | bitcoin-eeee5ada23f2a71d245671556b6ecfdaabfeddf4.tar.xz |
Make adjusted time type safe
Diffstat (limited to 'src/node/miner.cpp')
-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; |