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 anoutbound
orblock-relay-only
connection. (conceptually similar toaddnode
but for different connection types & restricted to regtest) - adds
test_framework
support so a mininode can open anoutbound
/block-relay-only
connection to aP2PInterface
/P2PConnection
. - updates
p2p_blocksonly
tests to create ablock-relay-only
connection & verify expectations around transaction relay. - introduces
p2p_add_connections
test that checks the behaviors of the newly introducedadd_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.
Huge props to ajtowns for conceiving the approach & providing me feedback as I’ve built out this branch. Also thank you to jnewbery for lots of thoughtful input along the way.