This is part of #27634.
This implements the BIP324 v2 transport (which implements all of what the BIP calls transport layer and application layer), though in a non-exposed way. It is tested through an extensive fuzz test, which verifies that v2 transports can talk to v2 transports, and v1 transports can talk to v2 transports, and a unit test that exercises a number of unusual scenarios. The transport is functionally complete, including:
- Autodetection of incoming V1 connections.
- Garbage, both sending and receiving.
- Short message type IDs, both sending and receiving.
- Ignore packets (receiving only, but tested in a unit test).
- Session IDs are visible in
getpeerinfo
output (for manual comparison).
Things that are not included, left for future PRs, are:
- Actually using the v2 transport for connections.
- Support for the
NODE_P2P_V2
service flag. - Retrying downgrade to V1 when attempted outbound V2 connections immediately fail.
- P2P functional and unit tests