In commit “doc: Fix and clarify description of ZMQ message format” (882375f2eb3942be644591ae45fbe57458ed40ee)
I had a hard time figuring out how how to read this section, because the list of topics is broken up by explanations and indented diagrams so it wasn’t clear what the text was referring to and where descriptions ended and began. Was also confused about why the first line only mentioned topics and now bodies but for some reason left off sequence numbers. And then even confused by extreme overloading of “sequence” to refer to zmq sequence numbers, mempool sequence numbers, and the literal sequence
string making up the first part of these messages.
Would recommend reorganizing to just show message struct up front, and save explanation for after. I also think it is important to use a consistent way of describing little endian numbers, and it would be good to describe sequence messages last since they are most confusing and complicated topic and overload the sequence number term that was just explained above. Would suggest:
The ZMQ messages that are sent look like the following, with topic strings, message bodies, and message sequence numbers in three parts:
0 | rawtx | <serialized transaction> | <4-byte LE uint sequence number> |
1 | hashtx | <32-byte transaction hash, reversed> | <4-byte LE uint sequence number> |
2 | rawblock | <serialized block> | <4-byte LE uint sequence number> |
3 | hashblock | <32-byte block hash, reversed> | <4-byte LE uint sequence number> |
4 | sequence | <32-byte block hash, reversed>C | <4-byte LE uint sequence number> |
5 | sequence | <32-byte block hash, reversed>D | <4-byte LE uint sequence number> |
6 | sequence | <32-byte transaction hash, reversed>R<8-byte LE uint> | <4-byte LE uint sequence number> |
7 | sequence | <32-byte transaction hash, reversed>A<8-byte LE uint> | <4-byte LE uint sequence number> |
Then the details about specific fields could be given below.