From 15dfd72f8ff47736a13c80743d5d132fd2763ecb Mon Sep 17 00:00:00 2001 From: 0xb10c Date: Wed, 13 Nov 2024 15:23:48 +0100 Subject: [PATCH] tracing: document that peer addrs can be >68 chars A v3 onion address with a `:` and a five digit port has a length of 68 chars. As noted in https://github.com/bitcoin/bitcoin/pull/25832#discussion_r1781040991 peers e.g. added via hostname might have a longer CNode::m_addr_name. These might be cut off in tracing tools. --- doc/tracing.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/tracing.md b/doc/tracing.md index 208d845f1f..0b53eed9ad 100644 --- a/doc/tracing.md +++ b/doc/tracing.md @@ -55,6 +55,9 @@ The currently available tracepoints are listed here. ### Context `net` +[^address-length]: An Onion v3 address with a `:` and a five digit port has 68 + chars. However, addresses of peers added with host names might be longer. + #### Tracepoint `net:inbound_message` Is called when a message is received from a peer over the P2P network. Passes @@ -62,7 +65,7 @@ information about our peer, the connection and the message as arguments. Arguments passed: 1. Peer ID as `int64` -2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters) +2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length]) 3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters) 4. Message Type (inv, ping, getdata, addrv2, ...) as `pointer to C-style String` (max. length 20 characters) 5. Message Size in bytes as `uint64` @@ -81,7 +84,7 @@ information about our peer, the connection and the message as arguments. Arguments passed: 1. Peer ID as `int64` -2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters) +2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length]) 3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters) 4. Message Type (inv, ping, getdata, addrv2, ...) as `pointer to C-style String` (max. length 20 characters) 5. Message Size in bytes as `uint64` @@ -100,7 +103,7 @@ the peer and the number of inbound connections including the newly opened connec Arguments passed: 1. Peer ID as `int64` -2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters) +2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length]) 3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters) 4. Network the peer connects from as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`. 5. Number of existing inbound connections as `uint64` including the newly opened inbound connection. @@ -112,7 +115,7 @@ the peer and the number of outbound connections including the newly opened conne Arguments passed: 1. Peer ID as `int64` -2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters) +2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length]) 3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters) 4. Network of the peer as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`. 5. Number of existing outbound connections as `uint64` including the newly opened outbound connection. @@ -123,7 +126,7 @@ Is called when a inbound connection is evicted by us. Passes information about t Arguments passed: 1. Peer ID as `int64` -2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters) +2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length]) 3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters) 4. Network the peer connects from as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`. 5. Connection established UNIX epoch timestamp in seconds as `uint64`. @@ -144,7 +147,7 @@ and the time at connection establishment. Arguments passed: 1. Peer ID as `int64` -2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters) +2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length]) 3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters) 4. Network the peer connects from as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`. 5. Connection established UNIX epoch timestamp in seconds as `uint64`.