@@ -367,12 +367,10 @@ struct CNodeState {
367
367
bool fPreferredDownload {false };
368
368
// ! Whether this peer wants invs or headers (when possible) for block announcements.
369
369
bool fPreferHeaders {false };
370
- // ! Whether this peer wants invs or cmpctblocks (when possible) for block announcements.
371
- bool fPreferHeaderAndIDs {false };
372
- /* *
373
- * Whether this peer will send us cmpctblocks if we request them.
374
- */
375
- bool fProvidesHeaderAndIDs {false };
370
+ /* * Whether this peer wants invs or cmpctblocks (when possible) for block announcements. */
371
+ bool m_requested_hb_cmpctblocks{false };
372
+ /* * Whether this peer will send us cmpctblocks if we request them. */
373
+ bool m_provides_cmpctblocks{false };
376
374
// ! Whether this peer can give us witnesses
377
375
bool fHaveWitness {false };
378
376
@@ -967,11 +965,11 @@ void PeerManagerImpl::MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid)
967
965
if (m_ignore_incoming_txs) return ;
968
966
969
967
CNodeState* nodestate = State (nodeid);
970
- if (!nodestate || !nodestate->fProvidesHeaderAndIDs ) {
968
+ if (!nodestate || !nodestate->m_provides_cmpctblocks ) {
971
969
// Don't request compact blocks if the peer has not signalled support
972
970
return ;
973
971
}
974
- if (nodestate->fProvidesHeaderAndIDs ) {
972
+ if (nodestate->m_provides_cmpctblocks ) {
975
973
int num_outbound_hb_peers = 0 ;
976
974
for (std::list<NodeId>::iterator it = lNodesAnnouncingHeaderAndIDs.begin (); it != lNodesAnnouncingHeaderAndIDs.end (); it++) {
977
975
if (*it == nodeid) {
@@ -1654,7 +1652,7 @@ void PeerManagerImpl::NewPoWValidBlock(const CBlockIndex *pindex, const std::sha
1654
1652
CNodeState &state = *State (pnode->GetId ());
1655
1653
// If the peer has, or we announced to them the previous block already,
1656
1654
// but we don't think they have this one, go ahead and announce it
1657
- if (state.fPreferHeaderAndIDs && !PeerHasHeader (&state, pindex) && PeerHasHeader (&state, pindex->pprev )) {
1655
+ if (state.m_requested_hb_cmpctblocks && !PeerHasHeader (&state, pindex) && PeerHasHeader (&state, pindex->pprev )) {
1658
1656
1659
1657
LogPrint (BCLog::NET, " %s sending header-and-ids %s to peer=%d\n " , " PeerManager::NewPoWValidBlock" ,
1660
1658
hashBlock.ToString (), pnode->GetId ());
@@ -1967,7 +1965,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
1967
1965
// they won't have a useful mempool to match against a compact block,
1968
1966
// and we don't feel like constructing the object for them, so
1969
1967
// instead we respond with the full, non-compact block.
1970
- bool fPeerWantsWitness = State (pfrom.GetId ())->fProvidesHeaderAndIDs ;
1968
+ bool fPeerWantsWitness = State (pfrom.GetId ())->m_provides_cmpctblocks ;
1971
1969
int nSendFlags = fPeerWantsWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
1972
1970
if (CanDirectFetch () && pindex->nHeight >= m_chainman.ActiveChain ().Height () - MAX_CMPCTBLOCK_DEPTH) {
1973
1971
if ((fPeerWantsWitness || !fWitnessesPresentInARecentCompactBlock ) && a_recent_compact_block && a_recent_compact_block->header .GetHash () == pindex->GetBlockHash ()) {
@@ -2138,7 +2136,7 @@ void PeerManagerImpl::SendBlockTransactions(CNode& pfrom, const CBlock& block, c
2138
2136
}
2139
2137
LOCK (cs_main);
2140
2138
const CNetMsgMaker msgMaker (pfrom.GetCommonVersion ());
2141
- int nSendFlags = State (pfrom.GetId ())->fProvidesHeaderAndIDs ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
2139
+ int nSendFlags = State (pfrom.GetId ())->m_provides_cmpctblocks ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
2142
2140
m_connman.PushMessage (&pfrom, msgMaker.Make (nSendFlags, NetMsgType::BLOCKTXN, resp));
2143
2141
}
2144
2142
@@ -2282,7 +2280,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
2282
2280
}
2283
2281
if (vGetData.size () > 0 ) {
2284
2282
if (!m_ignore_incoming_txs &&
2285
- nodestate->fProvidesHeaderAndIDs &&
2283
+ nodestate->m_provides_cmpctblocks &&
2286
2284
vGetData.size () == 1 &&
2287
2285
mapBlocksInFlight.size () == 1 &&
2288
2286
pindexLast->pprev ->IsValid (BLOCK_VALID_CHAIN)) {
@@ -2879,8 +2877,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
2879
2877
2880
2878
LOCK (cs_main);
2881
2879
CNodeState* nodestate = State (pfrom.GetId ());
2882
- nodestate->fProvidesHeaderAndIDs = true ;
2883
- nodestate->fPreferHeaderAndIDs = sendcmpct_hb;
2880
+ nodestate->m_provides_cmpctblocks = true ;
2881
+ nodestate->m_requested_hb_cmpctblocks = sendcmpct_hb;
2884
2882
// save whether peer selects us as BIP152 high-bandwidth peer
2885
2883
// (receiving sendcmpct(1) signals high-bandwidth, sendcmpct(0) low-bandwidth)
2886
2884
pfrom.m_bip152_highbandwidth_from = sendcmpct_hb;
@@ -3233,7 +3231,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
3233
3231
// actually receive all the data read from disk over the network.
3234
3232
LogPrint (BCLog::NET, " Peer %d sent us a getblocktxn for a block > %i deep\n " , pfrom.GetId (), MAX_BLOCKTXN_DEPTH);
3235
3233
CInv inv;
3236
- WITH_LOCK (cs_main, inv.type = State (pfrom.GetId ())->fProvidesHeaderAndIDs ? MSG_WITNESS_BLOCK : MSG_BLOCK);
3234
+ WITH_LOCK (cs_main, inv.type = State (pfrom.GetId ())->m_provides_cmpctblocks ? MSG_WITNESS_BLOCK : MSG_BLOCK);
3237
3235
inv.hash = req.blockhash ;
3238
3236
WITH_LOCK (peer->m_getdata_requests_mutex , peer->m_getdata_requests .push_back (inv));
3239
3237
// The message processing loop will go around again (without pausing) and we'll respond then
@@ -3609,7 +3607,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
3609
3607
return ;
3610
3608
}
3611
3609
3612
- if (DeploymentActiveAt (*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->fProvidesHeaderAndIDs ) {
3610
+ if (DeploymentActiveAt (*pindex, m_chainman, Consensus::DEPLOYMENT_SEGWIT) && !nodestate->m_provides_cmpctblocks ) {
3613
3611
// Don't bother trying to process compact blocks from v1 peers
3614
3612
// after segwit activates.
3615
3613
return ;
@@ -4704,7 +4702,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
4704
4702
LOCK (peer->m_block_inv_mutex );
4705
4703
std::vector<CBlock> vHeaders;
4706
4704
bool fRevertToInv = ((!state.fPreferHeaders &&
4707
- (!state.fPreferHeaderAndIDs || peer->m_blocks_for_headers_relay .size () > 1 )) ||
4705
+ (!state.m_requested_hb_cmpctblocks || peer->m_blocks_for_headers_relay .size () > 1 )) ||
4708
4706
peer->m_blocks_for_headers_relay .size () > MAX_BLOCKS_TO_ANNOUNCE);
4709
4707
const CBlockIndex *pBestIndex = nullptr ; // last header queued for delivery
4710
4708
ProcessBlockAvailability (pto->GetId ()); // ensure pindexBestKnownBlock is up-to-date
@@ -4757,7 +4755,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
4757
4755
}
4758
4756
}
4759
4757
if (!fRevertToInv && !vHeaders.empty ()) {
4760
- if (vHeaders.size () == 1 && state.fPreferHeaderAndIDs ) {
4758
+ if (vHeaders.size () == 1 && state.m_requested_hb_cmpctblocks ) {
4761
4759
// We only send up to 1 block as header-and-ids, as otherwise
4762
4760
// probably means we're doing an initial-ish-sync or they're slow
4763
4761
LogPrint (BCLog::NET, " %s sending header-and-ids %s to peer=%d\n " , __func__,
0 commit comments