From 25edb2b7bd4c41156fba09d0033a978e362435af Mon Sep 17 00:00:00 2001 From: John Newbery Date: Sat, 2 Jan 2021 15:17:53 +0000 Subject: [PATCH] [net processing] Simplify `sendcmpct` processing nCMPCTBLOCKVersion must always be 2 when processing. --- src/net_processing.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index d9c615c4be4..f7c51ab6ab2 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2891,17 +2891,15 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, // fProvidesHeaderAndIDs is used to "lock in" version of compact blocks we send (fWantsCmpctWitness) if (!State(pfrom.GetId())->fProvidesHeaderAndIDs) { State(pfrom.GetId())->fProvidesHeaderAndIDs = true; - State(pfrom.GetId())->fWantsCmpctWitness = nCMPCTBLOCKVersion == 2; + State(pfrom.GetId())->fWantsCmpctWitness = true; } - if (State(pfrom.GetId())->fWantsCmpctWitness == (nCMPCTBLOCKVersion == 2)) { // ignore later version announces + if (State(pfrom.GetId())->fWantsCmpctWitness) { State(pfrom.GetId())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK; // save whether peer selects us as BIP152 high-bandwidth peer // (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth) pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK; } - if (!State(pfrom.GetId())->fSupportsDesiredCmpctVersion) { - State(pfrom.GetId())->fSupportsDesiredCmpctVersion = (nCMPCTBLOCKVersion == 2); - } + State(pfrom.GetId())->fSupportsDesiredCmpctVersion = true; return; }