HomePhabricator

net: fix output of peer address in version message

Description

net: fix output of peer address in version message

Summary:
If -logips -debug=net is specified then we print the contents of the
version message we send to the peer, including his address. Because the
addresses in the version message use pre-BIP155 encoding they cannot
represent a Tor v3 address and we would actually send 16 0s instead (a
dummy IPv6 address). However we would print the full address in the log
message. Before this fix:

2020-10-21T12:24:17Z send version message: version 70016, blocks=653500, us=[::]:0, them=xwjtp3mj427zdp4tljiiivg2l5ijfvmt5lcsfaygtpp6cw254kykvpyd.onion:8333, peer=0

This is confusing because we pretend to send one thing while we actually
send another. Adjust the printout to reflect what we are sending. After
this fix:

2020-10-21T12:26:54Z send version message: version 70016, blocks=653500, us=[::]:0, them=[::]:0, peer=0

This is a backport of core#20212

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10608

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Oct 21 2020, 12:24
PiRKCommitted on Dec 1 2021, 17:05
PiRKPushed on Dec 1 2021, 17:05
Reviewer
Restricted Project
Differential Revision
D10608: net: fix output of peer address in version message
Parents
rABC7ce8011a6c7b: [avalanche] Improve the peer manager verify() method
Branches
Unknown
Tags
Unknown