HomePhabricator

[tests] Connect peer in outbound_slow_chain_eviction by sending p2p messages

Description

[tests] Connect peer in outbound_slow_chain_eviction by sending p2p messages

Summary:
Prior to this commit, the peer was connected, and then the services and
connectivity fields in the CNode object were manually set. Instead, send
p2p version and verack messages, and have net_processing's internal
logic set the state of the node.

This ensures that the node's internal state is consistent with how it
would be set in the live code.

Prior to this commit, dummyNode1.nServices was set to NODE_NONE
which was not a problem since CNode::fClient and
CNode::m_limited_node are default initialised to false. Now that we
are doing the actual version handshake, the values of fClient and
m_limited_node are set during the handshake and cause the test to fail
if we do not set dummyNode1.nServices to a reasonable value
(NODE_NETWORK).

This is a partial backport of core#25514 and core#25591
https://github.com/bitcoin/bitcoin/pull/25591/commits/fa7098947ceff1964812d430e769af6d1ad561bd (for Handshake)
https://github.com/bitcoin/bitcoin/pull/25514/commits/fc5eb528f7d7b33e2f2e443c5610a1551c7f099b

Depends on D14745

Test Plan: ninja check

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
MacroFake <falke.marco@gmail.com>Authored on Jul 11 2022, 16:14
PiRKCommitted on Nov 8 2023, 15:10
PiRKPushed on Nov 8 2023, 15:10
Reviewer
Restricted Project
Differential Revision
D14746: [tests] Connect peer in outbound_slow_chain_eviction by sending p2p messages
Parents
rABCf59dbfefff35: [net processing] Add m_our_services and m_their_services to Peer
Branches
Unknown
Tags
Unknown