From d1a93f5d41f7385af28cee3863976fd75f27415b Mon Sep 17 00:00:00 2001 From: Greg Sanders Date: Tue, 9 May 2023 13:35:02 -0400 Subject: [PATCH] Only request full blocks from the peer we thought had the block in-flight This is a change in behavior so that if for some reason we request a block from a peer, we don't allow an unsolicited CMPCT_BLOCK announcement for that same block to cause a request for a full block from the uninvited peer (as some type of request is already outstanding from the original peer) Github-Pull: #27626 Rebased-From: 13f9b20b4cb2f3f26e81184a77e9cf1f626d4f57 --- src/net_processing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 3a76b575f7a..d5d468a8ca0 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4304,7 +4304,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, if (pindex->nChainWork <= m_chainman.ActiveChain().Tip()->nChainWork || // We know something better pindex->nTx != 0) { // We had this block at some point, but pruned it - if (fAlreadyInFlight) { + if (in_flight_same_peer) { // We requested this block for some reason, but our mempool will probably be useless // so we just grab the block via normal getdata std::vector vInv(1); @@ -4383,7 +4383,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, } } } else { - if (fAlreadyInFlight) { + if (in_flight_same_peer) { // We requested this block, but its far into the future, so our // mempool will probably be useless - request the block normally std::vector vInv(1);