Skip to content

Commit 25bc840

Browse files
committed
Merge #20617: p2p: Remove m_is_manual_connection from CNodeState
a33442f Remove m_is_manual_connection from CNodeState (Antoine Riard) Pull request description: Currently, this member is only used to exclude MANUAL peers from discouragement in MaybePunishNodeForBlock(). Manual connections are already protected in MaybeDiscourageAndDisconnect(), independently from their network processing behaviors. ACKs for top commit: MarcoFalke: cr ACK a33442f promag: Code review ACK a33442f. jnewbery: utACK a33442f amitiuttarwar: code review ACK a33442f Tree-SHA512: cfe3f3dfa131373e3299002d34ae9e22ca6e1a966831bab32fcf06ff1d08f06095b4ab020cc4d267f3ec05ae23fbdc22373382ab828b999c0db11b8c842a4f0c
2 parents ade38b6 + a33442f commit 25bc840

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/net_processing.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,14 @@ struct CNodeState {
376376
//! Whether this peer is an inbound connection
377377
bool m_is_inbound;
378378

379-
//! Whether this peer is a manual connection
380-
bool m_is_manual_connection;
381-
382379
//! A rolling bloom filter of all announced tx CInvs to this peer.
383380
CRollingBloomFilter m_recently_announced_invs = CRollingBloomFilter{INVENTORY_MAX_RECENT_RELAY, 0.000001};
384381

385382
//! Whether this peer relays txs via wtxid
386383
bool m_wtxid_relay{false};
387384

388-
CNodeState(CAddress addrIn, bool is_inbound, bool is_manual)
389-
: address(addrIn), m_is_inbound(is_inbound), m_is_manual_connection(is_manual)
385+
CNodeState(CAddress addrIn, bool is_inbound)
386+
: address(addrIn), m_is_inbound(is_inbound)
390387
{
391388
pindexBestKnownBlock = nullptr;
392389
hashLastUnknownBlock.SetNull();
@@ -754,7 +751,7 @@ void PeerManager::InitializeNode(CNode *pnode) {
754751
NodeId nodeid = pnode->GetId();
755752
{
756753
LOCK(cs_main);
757-
mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(nodeid), std::forward_as_tuple(addr, pnode->IsInboundConn(), pnode->IsManualConn()));
754+
mapNodeState.emplace_hint(mapNodeState.end(), std::piecewise_construct, std::forward_as_tuple(nodeid), std::forward_as_tuple(addr, pnode->IsInboundConn()));
758755
assert(m_txrequest.Count(nodeid) == 0);
759756
}
760757
{
@@ -1054,8 +1051,8 @@ bool PeerManager::MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationSt
10541051
}
10551052

10561053
// Discourage outbound (but not inbound) peers if on an invalid chain.
1057-
// Exempt HB compact block peers and manual connections.
1058-
if (!via_compact_block && !node_state->m_is_inbound && !node_state->m_is_manual_connection) {
1054+
// Exempt HB compact block peers. Manual connections are always protected from discouragement.
1055+
if (!via_compact_block && !node_state->m_is_inbound) {
10591056
Misbehaving(nodeid, 100, message);
10601057
return true;
10611058
}

0 commit comments

Comments
 (0)