HomePhabricator

[tests] Allow outbound & block-relay-only connections in functional tests.

Description

[tests] Allow outbound & block-relay-only connections in functional tests.

Summary:

The existing functional test framework uses the addnode RPC to spin up manual connections between bitcoind nodes. This limits our ability to add integration tests for our networking code, which often executes different code paths for different connection types.

This PR enables creating outbound & block-relay-only P2P connections in the functional tests. This allows us to increase our p2p test coverage, since we can now verify expectations around these connection types.

This builds out the prototype proposed by ajtowns in #14210. 🙌🏽

An overview of this branch:

    introduces a new test-only RPC function addconnection which initiates opening an outbound or block-relay-only connection. (conceptually similar to addnode but for different connection types & restricted to regtest)
    adds test_framework support so a mininode can open an outbound/block-relay-only connection to a P2PInterface/P2PConnection.
    updates p2p_blocksonly tests to create a block-relay-only connection & verify expectations around transaction relay.
    introduces p2p_add_connections test that checks the behaviors of the newly introduced add_outbound_p2p_connection test framework function.

With these changes, there are many more behaviors that we can add integration tests for. The blocksonly updates is just one example.

Backport of core#19315.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
Amiti Uttarwar <amiti@uttarwar.org>Authored on Jun 2 2020, 16:46
FabienCommitted on Jan 19 2022, 14:31
FabienPushed on Jan 19 2022, 14:31
Reviewer
Restricted Project
Differential Revision
D10836: [tests] Allow outbound & block-relay-only connections in functional tests.
Parents
rABC533b749aced8: [seeder] Add some useful information about testing in the README
Branches
Unknown
Tags
Unknown