@@ -2883,22 +2883,24 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
2883
2883
bool fAnnounceUsingCMPCTBLOCK = false ;
2884
2884
uint64_t nCMPCTBLOCKVersion = 0 ;
2885
2885
vRecv >> fAnnounceUsingCMPCTBLOCK >> nCMPCTBLOCKVersion;
2886
- if (nCMPCTBLOCKVersion == 1 || nCMPCTBLOCKVersion == 2 ) {
2887
- LOCK (cs_main);
2888
- // fProvidesHeaderAndIDs is used to "lock in" version of compact blocks we send (fWantsCmpctWitness)
2889
- if (!State (pfrom.GetId ())->fProvidesHeaderAndIDs ) {
2890
- State (pfrom.GetId ())->fProvidesHeaderAndIDs = true ;
2891
- State (pfrom.GetId ())->fWantsCmpctWitness = nCMPCTBLOCKVersion == 2 ;
2892
- }
2893
- if (State (pfrom.GetId ())->fWantsCmpctWitness == (nCMPCTBLOCKVersion == 2 )) { // ignore later version announces
2894
- State (pfrom.GetId ())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK ;
2895
- // save whether peer selects us as BIP152 high-bandwidth peer
2896
- // (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
2897
- pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK ;
2898
- }
2899
- if (!State (pfrom.GetId ())->fSupportsDesiredCmpctVersion ) {
2900
- State (pfrom.GetId ())->fSupportsDesiredCmpctVersion = (nCMPCTBLOCKVersion == 2 );
2901
- }
2886
+
2887
+ // Only support compact block relay with witnesses
2888
+ if (nCMPCTBLOCKVersion != CMPCTBLOCKS_VERSION) return ;
2889
+
2890
+ LOCK (cs_main);
2891
+ // fProvidesHeaderAndIDs is used to "lock in" version of compact blocks we send (fWantsCmpctWitness)
2892
+ if (!State (pfrom.GetId ())->fProvidesHeaderAndIDs ) {
2893
+ State (pfrom.GetId ())->fProvidesHeaderAndIDs = true ;
2894
+ State (pfrom.GetId ())->fWantsCmpctWitness = nCMPCTBLOCKVersion == 2 ;
2895
+ }
2896
+ if (State (pfrom.GetId ())->fWantsCmpctWitness == (nCMPCTBLOCKVersion == 2 )) { // ignore later version announces
2897
+ State (pfrom.GetId ())->fPreferHeaderAndIDs = fAnnounceUsingCMPCTBLOCK ;
2898
+ // save whether peer selects us as BIP152 high-bandwidth peer
2899
+ // (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
2900
+ pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK ;
2901
+ }
2902
+ if (!State (pfrom.GetId ())->fSupportsDesiredCmpctVersion ) {
2903
+ State (pfrom.GetId ())->fSupportsDesiredCmpctVersion = (nCMPCTBLOCKVersion == 2 );
2902
2904
}
2903
2905
return ;
2904
2906
}
0 commit comments