We connect a new peer, wait for it using self.nodes[0].wait_for_new_peer() and then demand that "transport_protocol_type" is either "v1" or "v2". However wait_for_new_peer() may return too early - during the P2P handshake when "transport_protocol_type" is "detecting".
Fix this by waiting for the P2P handshake to complete and the protocol version to be established.
An example failure (equal fields removed for clarity):
AssertionError: not({
...
'session_id': '',
'transport_protocol_type': 'detecting',
} == {
...
'session_id': '8fe5902166b892a57ac6849caadd02d2dff83d84f2e57ee50bf894f93cf2f62e',
'transport_protocol_type': 'v2',
})