HomePhabricator

[net] Consolidate logic around calling CAddrMan::Connected()

Description

[net] Consolidate logic around calling CAddrMan::Connected()

Summary:
Currently, the logic around whether we called CAddrMan::Connected() for
a peer is spread between verack processing (where we discard inbound
peers) and FinalizeNode (where we discard misbehaving and
block-relay-only peers). Consolidate that logic to a single place.

Also remove the CNode.fCurrentlyConnected bool, which is now
redundant. We can rely on CNode.fSuccessfullyConnected, since the two
bools were only ever flipped to true in the same place.

This is a backport of core#20291 [1/2]
https://github.com/bitcoin/bitcoin/pull/20291/commits/eefe19471868ef0cdc9d32473d0b57015e7647ee

Depends on D10697

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10698

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Nov 3 2020, 09:15
PiRKCommitted on Dec 21 2021, 07:19
PiRKPushed on Dec 21 2021, 07:19
Reviewer
Restricted Project
Differential Revision
D10698: [net] Consolidate logic around calling CAddrMan::Connected()
Parents
rABC82d88e35d6d3: Avoid test-before-evict evictions of current peers
Branches
Unknown
Tags
Unknown