@@ -1313,7 +1313,7 @@ bool PeerManagerImpl::TipMayBeStale()
13131313
13141314bool PeerManagerImpl::CanDirectFetch ()
13151315{
1316- return m_chainman.ActiveChain ().Tip ()->Time () > GetAdjustedTime () - m_chainparams.GetConsensus ().PowTargetSpacing () * 20 ;
1316+ return m_chainman.ActiveChain ().Tip ()->Time () > NodeClock::now () - m_chainparams.GetConsensus ().PowTargetSpacing () * 20 ;
13171317}
13181318
13191319static bool PeerHasHeader (CNodeState *state, const CBlockIndex *pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
@@ -5552,7 +5552,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
55525552
55535553 if (!state.fSyncStarted && CanServeBlocks (*peer) && !m_chainman.m_blockman .LoadingBlocks ()) {
55545554 // Only actively request headers from a single peer, unless we're close to today.
5555- if ((nSyncStarted == 0 && sync_blocks_and_headers_from_peer) || m_chainman.m_best_header ->Time () > GetAdjustedTime () - 24h) {
5555+ if ((nSyncStarted == 0 && sync_blocks_and_headers_from_peer) || m_chainman.m_best_header ->Time () > NodeClock::now () - 24h) {
55565556 const CBlockIndex* pindexStart = m_chainman.m_best_header ;
55575557 /* If possible, start at the block preceding the currently
55585558 best known header. This ensures that we always get a
@@ -5572,7 +5572,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
55725572 // Convert HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER to microseconds before scaling
55735573 // to maintain precision
55745574 std::chrono::microseconds{HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER} *
5575- Ticks<std::chrono::seconds>(GetAdjustedTime () - m_chainman.m_best_header ->Time ()) / consensusParams.nPowTargetSpacing
5575+ Ticks<std::chrono::seconds>(NodeClock::now () - m_chainman.m_best_header ->Time ()) / consensusParams.nPowTargetSpacing
55765576 );
55775577 nSyncStarted++;
55785578 }
@@ -5876,7 +5876,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
58765876 // Check for headers sync timeouts
58775877 if (state.fSyncStarted && peer->m_headers_sync_timeout < std::chrono::microseconds::max ()) {
58785878 // Detect whether this is a stalling initial-headers-sync peer
5879- if (m_chainman.m_best_header ->Time () <= GetAdjustedTime () - 24h) {
5879+ if (m_chainman.m_best_header ->Time () <= NodeClock::now () - 24h) {
58805880 if (current_time > peer->m_headers_sync_timeout && nSyncStarted == 1 && (m_num_preferred_download_peers - state.fPreferredDownload >= 1 )) {
58815881 // Disconnect a peer (without NetPermissionFlags::NoBan permission) if it is our only sync peer,
58825882 // and we have others we could be using instead.
0 commit comments