From b13c1fc2ee983b766e8ab93bc7dcc2eb737fa701 Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Fri, 23 Feb 2024 10:36:25 -0500 Subject: [PATCH] net_processing: Don't attempt to direct fetch blocks from a node not advertising blocks --- src/net_processing.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index c8da927763443..4ffa7f48cd31f 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2770,6 +2770,9 @@ void PeerManagerImpl::HeadersDirectFetchBlocks(CNode& pfrom, const Peer& peer, c LOCK(cs_main); CNodeState *nodestate = State(pfrom.GetId()); + // Header was sent, but blocks not advertised + if(!CanServeBlocks(peer)) return; + if (CanDirectFetch() && last_header.IsValid(BLOCK_VALID_TREE) && m_chainman.ActiveChain().Tip()->nChainWork <= last_header.nChainWork) { std::vector vToFetch; const CBlockIndex* pindexWalk{&last_header};