aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2021-01-02 15:24:17 +0000
committerJohn Newbery <john@johnnewbery.com>2022-05-15 16:13:29 -0400
commita45d53cab556505048c387429fd07188e4c40c3d (patch)
tree8e0135a129d798672744a6170bf3954ee625d2c3 /src/net_processing.cpp
parent25edb2b7bd4c41156fba09d0033a978e362435af (diff)
downloadbitcoin-a45d53cab556505048c387429fd07188e4c40c3d.tar.xz
[net processing] Remove fSupportsDesiredCmpctVersion
It is now completely redundant with fProvidesHeadersAndIDs.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index f7c51ab6ab..4cbe325935 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -371,19 +371,12 @@ struct CNodeState {
bool fPreferHeaderAndIDs{false};
/**
* Whether this peer will send us cmpctblocks if we request them.
- * This is not used to gate request logic, as we really only care about fSupportsDesiredCmpctVersion,
- * but is used as a flag to "lock in" the version of compact blocks (fWantsCmpctWitness) we send.
*/
bool fProvidesHeaderAndIDs{false};
//! Whether this peer can give us witnesses
bool fHaveWitness{false};
//! Whether this peer wants witnesses in cmpctblocks/blocktxns
bool fWantsCmpctWitness{false};
- /**
- * If we've announced NODE_WITNESS to this peer: whether the peer sends witnesses in cmpctblocks/blocktxns,
- * otherwise: whether this peer sends non-witnesses in cmpctblocks/blocktxns.
- */
- bool fSupportsDesiredCmpctVersion{false};
/** State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
*
@@ -976,8 +969,8 @@ void PeerManagerImpl::MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid)
if (m_ignore_incoming_txs) return;
CNodeState* nodestate = State(nodeid);
- if (!nodestate || !nodestate->fSupportsDesiredCmpctVersion) {
- // Never ask from peers who can't provide witnesses.
+ if (!nodestate || !nodestate->fProvidesHeaderAndIDs) {
+ // Don't request compact blocks if the peer has not signalled support
return;
}
if (nodestate->fProvidesHeaderAndIDs) {
@@ -2292,7 +2285,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
}
if (vGetData.size() > 0) {
if (!m_ignore_incoming_txs &&
- nodestate->fSupportsDesiredCmpctVersion &&
+ nodestate->fProvidesHeaderAndIDs &&
vGetData.size() == 1 &&
mapBlocksInFlight.size() == 1 &&
pindexLast->pprev->IsValid(BLOCK_VALID_CHAIN)) {
@@ -2899,7 +2892,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
// (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
pfrom.m_bip152_highbandwidth_from = fAnnounceUsingCMPCTBLOCK;
}
- State(pfrom.GetId())->fSupportsDesiredCmpctVersion = true;
return;
}
@@ -3625,7 +3617,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
return;
}
- if (DeploymentActiveAt(*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fSupportsDesiredCmpctVersion) {
+ if (DeploymentActiveAt(*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fProvidesHeaderAndIDs) {
// Don't bother trying to process compact blocks from v1 peers
// after segwit activates.
return;