Bit numbering scheme in pubkey/service features #769

Open
opened 2015-01-18 22:42:17 +01:00 by Kagami · 4 comments
Kagami commented 2015-01-18 22:42:17 +01:00 (Migrated from github.com)
Hi. Another spec quirk. Service features bitfield uses LSB 0: https://github.com/Bitmessage/PyBitmessage/blob/master/src/shared.py#L149 https://bitmessage.org/wiki/Protocol_specification#version At the same time pubkey behavior bitfield uses MSB 0: https://github.com/Bitmessage/PyBitmessage/blob/master/src/class_singleWorker.py#L272 https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features https://github.com/Bitmessage/PyBitmessage/blob/master/src/class_singleWorker.py#L747 https://github.com/Bitmessage/PyBitmessage/blob/master/src/shared.py#L469 Should we be more consistent or at least mention this contradiction in the wiki?
Atheros1 commented 2015-01-21 17:19:16 +01:00 (Migrated from github.com)
>>> from struct import *
>>> pack('>q',1)
'\x00\x00\x00\x00\x00\x00\x00\x01'

It appears to me that shared.py#L149 is MSB 0.

``` >>> from struct import * >>> pack('>q',1) '\x00\x00\x00\x00\x00\x00\x00\x01' ``` It appears to me that shared.py#L149 is MSB 0.
Kagami commented 2015-01-21 17:26:07 +01:00 (Migrated from github.com)

Hm, you are right. I misread value 1 in

Value Name Description
1 NODE_NETWORK This is a normal network node.

as a bit number.
But it's still not very clear because pubkey bitfield uses bits and services bitfield uses BE values.

Hm, you are right. I misread value 1 in > Value Name Description > 1 NODE_NETWORK This is a normal network node. as a bit number. But it's still not very clear because pubkey bitfield uses bits and services bitfield uses BE values.
Atheros1 commented 2015-01-21 20:45:40 +01:00 (Migrated from github.com)

You are right that that is strange. The services bitfield I copied from Bitcoin because it seemed like a good idea but we don't make use of it yet and it appears that neither does Bitcoin.

You are right that that is strange. The services bitfield I copied from Bitcoin because it seemed like a good idea but we don't make use of it yet and it appears that neither does Bitcoin.
Kagami commented 2015-01-21 20:54:47 +01:00 (Migrated from github.com)

I know one very good use case for services bitfield: it will allow to find WebSocket gateway nodes for web clients because they can't create normal TCP connections. (Similar idea was proposed here.)
Also you was proposed to take one bit for TLS-enabled nodes.

I know one very good use case for services bitfield: it will allow to find WebSocket gateway nodes for web clients because they can't create normal TCP connections. (Similar idea was proposed [here](https://bitmessage.org/wiki/Mobile_Protocol_specification).) Also you was proposed to take one bit for TLS-enabled nodes.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Bitmessage/PyBitmessage-2025-02-25#769
No description provided.