From 2c7630ec610712655119e40a218539e042c8d7b2 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 13 Aug 2020 11:30:55 +0200 Subject: 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. --- bip-0155.mediawiki | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'bip-0155.mediawiki') diff --git a/bip-0155.mediawiki b/bip-0155.mediawiki index 5914241..c41930f 100644 --- a/bip-0155.mediawiki +++ b/bip-0155.mediawiki @@ -46,7 +46,7 @@ The addrv2 message is defined as a message where pchCommand = It is serialized in the standard encoding for P2P messages. Its format is similar to the current addr message format [https://bitcoin.org/en/developer-reference#addr Bitcoin Developer Reference: addr message], with the difference that the -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. +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. This means that the message contains a serialized std::vector of the following structure: @@ -55,9 +55,9 @@ This means that the message contains a serialized std::vector of th !Name !Description |- -| VARINT (unsigned) +| uint32_t | time -| Time that this node was last seen as connected to the network. A time in Unix epoch time format, up to 64 bits wide. +| Time that this node was last seen as connected to the network. A time in Unix epoch time format. |- | VARINT (unsigned) | services @@ -144,8 +144,6 @@ The reference implementation is available at (to be done) - Jonas Schnelli: change services field to VARINT, to make the message more compact in the likely case instead of always using 8 bytes. -- Luke-Jr: change time field to VARINT, for post-2038 compatibility. - - Gregory Maxwell: various suggestions regarding extensibility ==Appendix A: Tor v2 address encoding== -- cgit v1.2.3 From 87ef5aaa7c10f4696d1fb0cc152bc3c0142acf8f Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 13 Aug 2020 11:36:10 +0200 Subject: BIP155: clarify that "services" uses CompactSize 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. --- bip-0155.mediawiki | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bip-0155.mediawiki') diff --git a/bip-0155.mediawiki b/bip-0155.mediawiki index c41930f..6f538d4 100644 --- a/bip-0155.mediawiki +++ b/bip-0155.mediawiki @@ -46,7 +46,7 @@ The addrv2 message is defined as a message where pchCommand = It is serialized in the standard encoding for P2P messages. Its format is similar to the current addr message format [https://bitcoin.org/en/developer-reference#addr Bitcoin Developer Reference: addr message], 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 std::vector of the following structure: @@ -59,9 +59,9 @@ This means that the message contains a serialized std::vector of th | time | Time that this node was last seen as connected to the network. A time in Unix epoch time format. |- -| VARINT (unsigned) +| CompactSize | services -| Service bits. A 64-wide bit field. +| Service bits. A bit field that is 64 bits wide, encoded in [https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer CompactSize]. |- | uint8_t | networkID @@ -142,7 +142,7 @@ The reference implementation is available at (to be done) ==Acknowledgements== -- Jonas Schnelli: change services field to VARINT, to make the message more compact in the likely case instead of always using 8 bytes. +- Jonas Schnelli: change services 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 -- cgit v1.2.3