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.