Skip to content

Commit

Permalink
BIP155: clarify that "services" uses CompactSize
Browse files Browse the repository at this point in the history
The Bitcoin Core source code has `VARINT` type which is different than
the "variable integer" format used all over the P2P protocol and also
for the "services" field in this BIP. The latter is called `CompactSize`
in some BIPs and also in the Bitcoin Core source code, thus use the word
`CompactSize` to refer to it and link to its documentation.
  • Loading branch information
vasild committed Aug 13, 2020
1 parent 2c7630e commit 44ff4bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bip-0155.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The <code>addrv2</code> message is defined as a message where <code>pchCommand =
It is serialized in the standard encoding for P2P messages.
Its format is similar to the current <code>addr</code> message format
<ref>[https://bitcoin.org/en/developer-reference#addr Bitcoin Developer Reference: addr message]</ref>, with the difference that the
fixed 16-byte IP address is replaced by a network ID and a variable-length address, and the services format has been changed to VARINT.
fixed 16-byte IP address is replaced by a network ID and a variable-length address, and the services format has been changed to [https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer CompactSize].

This means that the message contains a serialized <code>std::vector</code> of the following structure:

Expand All @@ -59,9 +59,9 @@ This means that the message contains a serialized <code>std::vector</code> of th
| <code>time</code>
| Time that this node was last seen as connected to the network. A time in Unix epoch time format.
|-
| <code>VARINT</code> (unsigned)
| <code>CompactSize</code>
| <code>services</code>
| Service bits. A 64-wide bit field.
| Service bits. A bit field that is 64-bit wide, encoded in [https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer CompactSize].
|-
| <code>uint8_t</code>
| <code>networkID</code>
Expand Down Expand Up @@ -142,7 +142,7 @@ The reference implementation is available at (to be done)

==Acknowledgements==

- Jonas Schnelli: change <code>services</code> field to VARINT, to make the message more compact in the likely case instead of always using 8 bytes.
- Jonas Schnelli: change <code>services</code> field to [https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer CompactSize], to make the message more compact in the likely case instead of always using 8 bytes.

- Gregory Maxwell: various suggestions regarding extensibility

Expand Down

0 comments on commit 44ff4bf

Please sign in to comment.