Skip to content

Commit a45d53c

Browse files
committed
[net processing] Remove fSupportsDesiredCmpctVersion
It is now completely redundant with fProvidesHeadersAndIDs.
1 parent 25edb2b commit a45d53c

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/net_processing.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -371,19 +371,12 @@ struct CNodeState {
371371
bool fPreferHeaderAndIDs{false};
372372
/**
373373
* 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.
376374
*/
377375
bool fProvidesHeaderAndIDs{false};
378376
//! Whether this peer can give us witnesses
379377
bool fHaveWitness{false};
380378
//! Whether this peer wants witnesses in cmpctblocks/blocktxns
381379
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};
387380

388381
/** State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
389382
*
@@ -976,8 +969,8 @@ void PeerManagerImpl::MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid)
976969
if (m_ignore_incoming_txs) return;
977970

978971
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
981974
return;
982975
}
983976
if (nodestate->fProvidesHeaderAndIDs) {
@@ -2292,7 +2285,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
22922285
}
22932286
if (vGetData.size() > 0) {
22942287
if (!m_ignore_incoming_txs &&
2295-
nodestate->fSupportsDesiredCmpctVersion &&
2288+
nodestate->fProvidesHeaderAndIDs &&
22962289
vGetData.size() == 1 &&
22972290
mapBlocksInFlight.size() == 1 &&
22982291
pindexLast->pprev->IsValid(BLOCK_VALID_CHAIN)) {
@@ -2899,7 +2892,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
28992892
// (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
29002893
pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK;
29012894
}
2902-
State(pfrom.GetId())->fSupportsDesiredCmpctVersion = true;
29032895
return;
29042896
}
29052897

@@ -3625,7 +3617,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
36253617
return;
36263618
}
36273619

3628-
if (DeploymentActiveAt(*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fSupportsDesiredCmpctVersion) {
3620+
if (DeploymentActiveAt(*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fProvidesHeaderAndIDs) {
36293621
// Don't bother trying to process compact blocks from v1 peers
36303622
// after segwit activates.
36313623
return;

0 commit comments

Comments
 (0)