diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-11-04 13:41:47 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-11-04 13:41:52 +0100 |
commit | 1209b6c692c14dc1435d653f3c032ae22a98af8e (patch) | |
tree | e989d582ff31ee456200282cdc66e4f212cbd881 /src | |
parent | 88776c2926061482ab551b0cf5c408fc1bc39ac3 (diff) | |
parent | af3b0dfc5463c42fb9bff39f020fc1728ed44bc7 (diff) | |
download | bitcoin-1209b6c692c14dc1435d653f3c032ae22a98af8e.tar.xz |
Merge #20212: net: fix output of peer address in version message
af3b0dfc5463c42fb9bff39f020fc1728ed44bc7 net: fix output of peer address in version message (Vasil Dimov)
Pull request description:
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 `0`s 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
```
ACKs for top commit:
MarcoFalke:
review ACK af3b0dfc5463c42fb9bff39f020fc1728ed44bc7
jnewbery:
utACK af3b0dfc5463c42fb9bff39f020fc1728ed44bc7
Tree-SHA512: f169d7b4f07c219e541f7c37ea23b82c77e50085fc72ec62f1dd46970389916e177268d07d45c7be94dd209d1903f8f23eaff62b7fa782f6057dd36bb96bba82
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 9dafda43c8..c649cf7757 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -498,7 +498,9 @@ static void PushNodeVersion(CNode& pnode, CConnman& connman, int64_t nTime) NodeId nodeid = pnode.GetId(); CAddress addr = pnode.addr; - CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService(), addr.nServices)); + CAddress addrYou = addr.IsRoutable() && !IsProxy(addr) && addr.IsAddrV1Compatible() ? + addr : + CAddress(CService(), addr.nServices); CAddress addrMe = CAddress(CService(), nLocalNodeServices); connman.PushMessage(&pnode, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERSION, PROTOCOL_VERSION, (uint64_t)nLocalNodeServices, nTime, addrYou, addrMe, |