Skip to content

Commit 2c7630e

Browse files
committed
BIP155: change "time" to fixed 32 bit unsigned
32 bit unsigned can represent time up to year 2106 (32 bit signed is limited to just 2038). So, we don't need to have "time" encoded as variable integer which would take 5 bytes instead of 4.
1 parent cb071df commit 2c7630e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

bip-0155.mediawiki

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The <code>addrv2</code> message is defined as a message where <code>pchCommand =
4646
It is serialized in the standard encoding for P2P messages.
4747
Its format is similar to the current <code>addr</code> message format
4848
<ref>[https://bitcoin.org/en/developer-reference#addr Bitcoin Developer Reference: addr message]</ref>, with the difference that the
49-
fixed 16-byte IP address is replaced by a network ID and a variable-length address, and the time and services format has been changed to VARINT.
49+
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.
5050

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

@@ -55,9 +55,9 @@ This means that the message contains a serialized <code>std::vector</code> of th
5555
!Name
5656
!Description
5757
|-
58-
| <code>VARINT</code> (unsigned)
58+
| <code>uint32_t</code>
5959
| <code>time</code>
60-
| Time that this node was last seen as connected to the network. A time in Unix epoch time format, up to 64 bits wide.
60+
| Time that this node was last seen as connected to the network. A time in Unix epoch time format.
6161
|-
6262
| <code>VARINT</code> (unsigned)
6363
| <code>services</code>
@@ -144,8 +144,6 @@ The reference implementation is available at (to be done)
144144

145145
- 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.
146146

147-
- Luke-Jr: change <code>time</code> field to VARINT, for post-2038 compatibility.
148-
149147
- Gregory Maxwell: various suggestions regarding extensibility
150148

151149
==Appendix A: Tor v2 address encoding==

0 commit comments

Comments
 (0)