Now that we require Python 3.6+, we should be using variable type
annotations directly rather than # type:
comments.
Also takes care of the discarded value issue in p2p_message_capture.py. See: https://github.com/bitcoin/bitcoin/pull/19509/files#r571674446.