@@ -2453,7 +2453,7 @@ void PeerManagerImpl::AvalanchePeriodicNetworking(CScheduler &scheduler) const {
24532453 }
24542454 }
24552455
2456- if (m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) {
2456+ if (m_chainman.IsInitialBlockDownload ()) {
24572457 // Don't request proofs while in IBD. We're likely to orphan them
24582458 // because we don't have the UTXOs.
24592459 goto scheduleLater;
@@ -3081,8 +3081,7 @@ void PeerManagerImpl::BlockChecked(const CBlock &block,
30813081 // 3. This is currently the best block we're aware of. We haven't updated
30823082 // the tip yet so we have no way to check this directly here. Instead we
30833083 // just check that there are currently no other blocks in flight.
3084- else if (state.IsValid () &&
3085- !m_chainman.ActiveChainstate ().IsInitialBlockDownload () &&
3084+ else if (state.IsValid () && !m_chainman.IsInitialBlockDownload () &&
30863085 mapBlocksInFlight.count (hash) == mapBlocksInFlight.size ()) {
30873086 if (it != mapBlockSource.end ()) {
30883087 MaybeSetPeerAsAnnouncingHeaderAndIDs (it->second .first );
@@ -4057,8 +4056,7 @@ void PeerManagerImpl::UpdatePeerStateForReceivedHeaders(
40574056
40584057 // If we're in IBD, we want outbound peers that will serve us a useful
40594058 // chain. Disconnect peers that are on chains with insufficient work.
4060- if (m_chainman.ActiveChainstate ().IsInitialBlockDownload () &&
4061- !may_have_more_headers) {
4059+ if (m_chainman.IsInitialBlockDownload () && !may_have_more_headers) {
40624060 // When nCount < MAX_HEADERS_RESULTS, we know we have no more
40634061 // headers to fetch from this peer.
40644062 if (nodestate->pindexBestKnownBlock &&
@@ -5380,7 +5378,7 @@ void PeerManagerImpl::ProcessMessage(
53805378 AddKnownProof (*peer, proofid);
53815379
53825380 if (!fAlreadyHave && m_avalanche &&
5383- !m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) {
5381+ !m_chainman.IsInitialBlockDownload ()) {
53845382 const bool preferred = isPreferredDownloadPeer (pfrom);
53855383
53865384 LOCK (cs_proofrequest);
@@ -5405,8 +5403,8 @@ void PeerManagerImpl::ProcessMessage(
54055403 txid.ToString (), pfrom.GetId ());
54065404 pfrom.fDisconnect = true ;
54075405 return ;
5408- } else if (!fAlreadyHave && !m_chainman. ActiveChainstate ()
5409- .IsInitialBlockDownload ()) {
5406+ } else if (!fAlreadyHave &&
5407+ !m_chainman .IsInitialBlockDownload ()) {
54105408 AddTxAnnouncement (pfrom, txid, current_time);
54115409 }
54125410
@@ -5747,7 +5745,7 @@ void PeerManagerImpl::ProcessMessage(
57475745 // don't have enough information to validate it yet. Sending unsolicited
57485746 // transactions is not considered a protocol violation, so don't punish
57495747 // the peer.
5750- if (m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) {
5748+ if (m_chainman.IsInitialBlockDownload ()) {
57515749 return ;
57525750 }
57535751
@@ -6024,7 +6022,7 @@ void PeerManagerImpl::ProcessMessage(
60246022 if (!prev_block) {
60256023 // Doesn't connect (or is genesis), instead of DoSing in
60266024 // AcceptBlockHeader, request deeper headers
6027- if (!m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) {
6025+ if (!m_chainman.IsInitialBlockDownload ()) {
60286026 MaybeSendGetHeaders (
60296027 pfrom, GetLocator (m_chainman.m_best_header ), *peer);
60306028 }
@@ -6516,9 +6514,8 @@ void PeerManagerImpl::ProcessMessage(
65166514 // unless we're still syncing with the network. Such an unrequested
65176515 // block may still be processed, subject to the conditions in
65186516 // AcceptBlock().
6519- bool forceProcessing =
6520- pfrom.HasPermission (NetPermissionFlags::NoBan) &&
6521- !m_chainman.ActiveChainstate ().IsInitialBlockDownload ();
6517+ bool forceProcessing = pfrom.HasPermission (NetPermissionFlags::NoBan) &&
6518+ !m_chainman.IsInitialBlockDownload ();
65226519 const BlockHash hash = pblock->GetHash ();
65236520 bool min_pow_checked = false ;
65246521 {
@@ -6618,8 +6615,7 @@ void PeerManagerImpl::ProcessMessage(
66186615 WITH_LOCK (peer->m_addr_token_bucket_mutex ,
66196616 peer->m_addr_token_bucket += m_opts.max_addr_to_send );
66206617
6621- if (peer->m_proof_relay &&
6622- !m_chainman.ActiveChainstate ().IsInitialBlockDownload ()) {
6618+ if (peer->m_proof_relay && !m_chainman.IsInitialBlockDownload ()) {
66236619 m_connman.PushMessage (&pfrom,
66246620 msgMaker.Make (NetMsgType::GETAVAPROOFS));
66256621 peer->m_proof_relay ->compactproofs_requested = true ;
@@ -8180,7 +8176,7 @@ void PeerManagerImpl::MaybeSendAddr(CNode &node, Peer &peer,
81808176 }
81818177
81828178 LOCK (peer.m_addr_send_times_mutex );
8183- if (fListen && !m_chainman.ActiveChainstate (). IsInitialBlockDownload () &&
8179+ if (fListen && !m_chainman.IsInitialBlockDownload () &&
81848180 peer.m_next_local_addr_send < current_time) {
81858181 // If we've sent before, clear the bloom filter for the peer, so
81868182 // that our self-announcement will actually go out. This might
@@ -8300,7 +8296,7 @@ void PeerManagerImpl::MaybeSendFeefilter(
83008296
83018297 Amount currentFilter = m_mempool.GetMinFee ().GetFeePerK ();
83028298
8303- if (m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) {
8299+ if (m_chainman.IsInitialBlockDownload ()) {
83048300 // Received tx-inv messages are discarded when the active
83058301 // chainstate is in IBD, so tell the peer to not send them.
83068302 currentFilter = MAX_MONEY;
@@ -9003,7 +8999,7 @@ bool PeerManagerImpl::SendMessages(const Config &config, CNode *pto) {
90038999
90049000 if (CanServeBlocks (*peer) &&
90059001 ((sync_blocks_and_headers_from_peer && !IsLimitedPeer (*peer)) ||
9006- !m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) &&
9002+ !m_chainman.IsInitialBlockDownload ()) &&
90079003 state.vBlocksInFlight .size () < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
90089004 std::vector<const CBlockIndex *> vToDownload;
90099005 NodeId staller = -1 ;
@@ -9129,7 +9125,7 @@ bool PeerManagerImpl::ReceivedAvalancheProof(CNode &node, Peer &peer,
91299125
91309126 AddKnownProof (peer, proofid);
91319127
9132- if (m_chainman.ActiveChainstate (). IsInitialBlockDownload ()) {
9128+ if (m_chainman.IsInitialBlockDownload ()) {
91339129 // We cannot reliably verify proofs during IBD, so bail out early and
91349130 // keep the inventory as pending so it can be requested when the node
91359131 // has synced.
0 commit comments