@@ -371,19 +371,12 @@ struct CNodeState {
371
371
bool fPreferHeaderAndIDs {false };
372
372
/* *
373
373
* Whether this peer will send us cmpctblocks if we request them.
374
- * This is not used to gate request logic, as we really only care about fSupportsDesiredCmpctVersion,
375
- * but is used as a flag to "lock in" the version of compact blocks (fWantsCmpctWitness) we send.
376
374
*/
377
375
bool fProvidesHeaderAndIDs {false };
378
376
// ! Whether this peer can give us witnesses
379
377
bool fHaveWitness {false };
380
378
// ! Whether this peer wants witnesses in cmpctblocks/blocktxns
381
379
bool fWantsCmpctWitness {false };
382
- /* *
383
- * If we've announced NODE_WITNESS to this peer: whether the peer sends witnesses in cmpctblocks/blocktxns,
384
- * otherwise: whether this peer sends non-witnesses in cmpctblocks/blocktxns.
385
- */
386
- bool fSupportsDesiredCmpctVersion {false };
387
380
388
381
/* * State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
389
382
*
@@ -976,8 +969,8 @@ void PeerManagerImpl::MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid)
976
969
if (m_ignore_incoming_txs) return ;
977
970
978
971
CNodeState* nodestate = State (nodeid);
979
- if (!nodestate || !nodestate->fSupportsDesiredCmpctVersion ) {
980
- // Never ask from peers who can't provide witnesses.
972
+ if (!nodestate || !nodestate->fProvidesHeaderAndIDs ) {
973
+ // Don't request compact blocks if the peer has not signalled support
981
974
return ;
982
975
}
983
976
if (nodestate->fProvidesHeaderAndIDs ) {
@@ -2292,7 +2285,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
2292
2285
}
2293
2286
if (vGetData.size () > 0 ) {
2294
2287
if (!m_ignore_incoming_txs &&
2295
- nodestate->fSupportsDesiredCmpctVersion &&
2288
+ nodestate->fProvidesHeaderAndIDs &&
2296
2289
vGetData.size () == 1 &&
2297
2290
mapBlocksInFlight.size () == 1 &&
2298
2291
pindexLast->pprev ->IsValid (BLOCK_VALID_CHAIN)) {
@@ -2899,7 +2892,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
2899
2892
// (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
2900
2893
pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK ;
2901
2894
}
2902
- State (pfrom.GetId ())->fSupportsDesiredCmpctVersion = true ;
2903
2895
return ;
2904
2896
}
2905
2897
@@ -3625,7 +3617,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
3625
3617
return ;
3626
3618
}
3627
3619
3628
- if (DeploymentActiveAt (*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fSupportsDesiredCmpctVersion ) {
3620
+ if (DeploymentActiveAt (*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fProvidesHeaderAndIDs ) {
3629
3621
// Don't bother trying to process compact blocks from v1 peers
3630
3622
// after segwit activates.
3631
3623
return ;
0 commit comments