Skip to content

Commit 40e6634

Browse files
committed
BIP324: define message_length
1 parent 4c80568 commit 40e6634

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

bip-0324.mediawiki

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,8 @@ v2 Bitcoin P2P transport layer packets use the encrypted message structure shown
531531
532532
If the first byte of <code>message_type</code> is <code>b'\x00'</code>, the following 12 bytes are interpreted as an ASCII message type (as in the v1 P2P protocol), trailing padded with <code>b'\x00'</code> as necessary. If the first byte of <code>message_type</code> is in the range ''1..255'', it is interpreted as a message type ID. This structure results in smaller messages than the v1 protocol, as most messages sent/received will have a message type ID. We recommend reserving 1-byte type IDs for message types that are sent more than once per direction per connection.<ref name="smaller_messages">'''How do the lengths between v1 and v2 compare?''' For messages that use the 1-byte short message type ID, v2 packets use 3 bytes less per message than v1.</ref><ref name"fixed_length_long_ids">'''Why not allow variable length long message type IDs?''' Allowing for variable length long IDs reduces the available 1-byte ID space by 12 (to encode the length itself) and incentivizes less descriptive message types. In addition, limiting message types to fixed lengths of 1 or 13 hampers traffic analysis.</ref>
533533
534+
The value of <code>message_length</code> is '''length''' minus the size of the <code>message_type</code>.
535+
534536
The following table lists currently defined message type IDs and the 12-byte ASCII message type (trimmed of trailing padding) that they are treated as equivalent to:
535537
536538
{| class="wikitable"

0 commit comments

Comments
 (0)