0

BIP152 explains two types of block announcing:

  • High Bandwidth Relaying (sendcmpct(1))
  • Low Bandwidth Relaying (sendcmpct(0))

I understand why we need sendcmpct message for the first case. In this way, we inform the peer that we want it to notify us by sending us a compact block. Similar to when we send a sendheaders message indicating that we want announcing via the header, not the inv.

I don't understand why the sendcmpct message is needed for the second case. In second case, notifying is done via header/inv, and then if we want a compact block, we need to send getdata(MSG_CMPCT_BLOCK). If we don't want to, we send MSG_BLOCK or MSG_WITNESS_BLOCK. Therefore, everything would work the same if we previously didn't send a sendcmpct message first.

1 Answer 1

4

sendcmpct(0) simply informs the peer that compact block support is available. Without it, the peer wouldn't know that MSG_CMPCT_BLOCK is supported by us.

So:

  • sendcmpct(0) means "You can ask me for compact blocks".
  • sendcmpct(1) means "You can ask me for compact blocks, and also please send them to me without me asking"
7
  • But if I send MSG_CMPCT_BLOCK in getdata message it means that I am supporting it (since I am requesting it). If I am not supporting it, I would not send getdata with that type, but with MSG_BLOCK or MSG_WITNESS_BLOCK. And peer would have known if it was supported based on the version when establishing the connection. If the version is greater than or equal to 70014, it means that we support it
    – Cosmos
    Commented Dec 23, 2023 at 18:43
  • No, sendcmpct is how you let your peer know that you support compact blocks. Protocol version 70014 simply means the sendcmpct command exists, not that compact blocks are actually supported. BIP152 states you're not allowed to use MSG_WITNESS_BLOCK or any of the other compact-block related messages unless you've received a sendcmpct message. Commented Dec 23, 2023 at 19:12
  • 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. I do not understand this: "Protocol version 70014 simply means the sendcmpct command exists, not that compact blocks are actually supported.". If the command exists, then compact blocks are supported?
    – Cosmos
    Commented Dec 23, 2023 at 21:14
  • 1
    70014 does not require you to support compact blocks. It just enables the negotiation thereof. To take an example, BIP339; it adds a feature called wtxid-based relay, in protocol 70016 or higher. It would be unacceptable if any node that wishes to support wtxid-based relay also was forced to implement compact blocks, just because there is no way to signal support for wtxidrelay without supporting compact blocks. Therefore, the protocol version number just controls which messages can be sent, but not actual feature support. That's negotiated using feature-specific messages like sendcmpct. Commented Dec 23, 2023 at 21:44
  • 1
    Ah, I think I understand now. So the version number only means that some future version "maybe" is supported by me/my peer (in sense that we can negotiate about it), but it does not necessarily mean that it is actually supported. We can establish whether something is really supported through negotiations, for example, through additional messages (eg sendcmpct) or through service flags or something else. If the version is smaller, then we don't have anything to negotiate, since that future was introduced only in the next (future) versions, which I/my peer don't even support. That's the point?
    – Cosmos
    Commented Dec 23, 2023 at 21:54

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.