0

I thought that the version messages that are exchanged when establishing a connection between two nodes and the version field within them indicate what each node supports. Each version supports some new feature and then, depending on which versions are exchanged in these messages between the nodes, a smaller version of the protocol is used and each node knows what it can "ask" other nodes.

However, based on this answer and comment:

Protocol version 70014 simply means the sendcmpct command exists, not that compact blocks are actually supported.

...it seems to me that my assumptions are wrong.

Therefore, what is the purpose of the version field in the version message

2 Answers 2

3

A node establishes which "language" it will speak with other nodes per the protocol version. The protocol version defines which messages exist and what responses are deemed acceptable to those messages. It is still up to the nodes to establish which features they support by using the available vocabulary.

E.g. consider a node with a complete copy of the blockchain vs a pruned node. Both nodes may speak the same version of the protocol, both will advertise the NODE_NETWORK_LIMITED service, but only one will advertise NODE_NETWORK. Asking the pruned node for an old block would be a violation because they did not advertise NODE_NETWORK, even though their protocol version enables them to understand perfectly what was requested.

1
  • Yes. The example that Pieter Wuille left in the comment (link is above) is also good and explains it well
    – Cosmos
    Dec 27, 2023 at 18:25
1

The purpose of version field in version messages exchanged during establishing a connection is for the nodes to see which features they can negotiate with each other. The fact that some node supports a certain version does not necessarily mean that it supports all the features related to it (all the features introduced in that version or versions before). In order to see if something is really supported, some negotiation mechanism is necessary.

For more information see correspondence between @PieterWuille and myself here.

You can see all the methods used for negotiation here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.