Skip to content

Commit e3622a9

Browse files
committed
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 bitcoin/bitcoin#25832 (comment) peers e.g. added via hostname might have a longer CNode::m_addr_name. These might be cut off in tracing tools.
1 parent b19b526 commit e3622a9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

doc/tracing.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ The currently available tracepoints are listed here.
5555

5656
### Context `net`
5757

58+
[^address-length]: An Onion v3 address with a `:` and a five digit port has 68
59+
chars. However, addresses of peers added with host names might be longer.
60+
5861
#### Tracepoint `net:inbound_message`
5962

6063
Is called when a message is received from a peer over the P2P network. Passes
6164
information about our peer, the connection and the message as arguments.
6265

6366
Arguments passed:
6467
1. Peer ID as `int64`
65-
2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
68+
2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length])
6669
3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
6770
4. Message Type (inv, ping, getdata, addrv2, ...) as `pointer to C-style String` (max. length 20 characters)
6871
5. Message Size in bytes as `uint64`
@@ -81,7 +84,7 @@ information about our peer, the connection and the message as arguments.
8184

8285
Arguments passed:
8386
1. Peer ID as `int64`
84-
2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
87+
2. Peer Address and Port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length])
8588
3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
8689
4. Message Type (inv, ping, getdata, addrv2, ...) as `pointer to C-style String` (max. length 20 characters)
8790
5. Message Size in bytes as `uint64`
@@ -100,7 +103,7 @@ the peer and the number of inbound connections including the newly opened connec
100103

101104
Arguments passed:
102105
1. Peer ID as `int64`
103-
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
106+
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length])
104107
3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
105108
4. Network the peer connects from as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`.
106109
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
112115

113116
Arguments passed:
114117
1. Peer ID as `int64`
115-
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
118+
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length])
116119
3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
117120
4. Network of the peer as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`.
118121
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
123126

124127
Arguments passed:
125128
1. Peer ID as `int64`
126-
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
129+
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length])
127130
3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
128131
4. Network the peer connects from as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`.
129132
5. Connection established UNIX epoch timestamp in seconds as `uint64`.
@@ -144,7 +147,7 @@ and the time at connection establishment.
144147

145148
Arguments passed:
146149
1. Peer ID as `int64`
147-
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (max. length 68 characters)
150+
2. Peer address and port (IPv4, IPv6, Tor v3, I2P, ...) as `pointer to C-style String` (normally up to 68 characters[^address-length])
148151
3. Connection Type (inbound, feeler, outbound-full-relay, ...) as `pointer to C-style String` (max. length 20 characters)
149152
4. Network the peer connects from as `uint32` (1 = IPv4, 2 = IPv6, 3 = Onion, 4 = I2P, 5 = CJDNS). See `Network` enum in `netaddress.h`.
150153
5. Connection established UNIX epoch timestamp in seconds as `uint64`.

0 commit comments

Comments
 (0)