Skip to content

Commit a33442f

Browse files
author
Antoine Riard
committed
Remove m_is_manual_connection from CNodeState
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.
1 parent b76abae commit a33442f

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)