Skip to content

Commit 65ec4f7

Browse files
committed
Update record encoding to use fixed-size length prefix in P2P transport documentation
1 parent fa3fd5c commit 65ec4f7

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

zips/draft-arya-jvff-p2p-quic-transport.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,12 @@ sequence of records for one announcement topic.
680680

681681
### Records
682682

683-
Each record on an announcement or handshake stream is encoded as a CompactSize
684-
length prefix followed by that many bytes of payload:
683+
Each record on an announcement or handshake stream is encoded as a fixed-size
684+
4-byte length prefix followed by that many bytes of payload:
685685

686686
| Size | Field | Description |
687687
|--------|-----------|----------------------------------------------------|
688-
| varies | `length` | Payload length in bytes (CompactSize). |
688+
| 4 | `length` | Payload length in bytes (`uint32`, little-endian). |
689689
| varies | `payload` | Record payload; format depends on the stream type. |
690690

691691
The maximum length of a record payload — and of any individually
@@ -1213,20 +1213,18 @@ Stream type: `0x05`
12131213
byte).
12141214

12151215
**Response:** Open-ended. The response is a sequence of records (see
1216-
[Records](#records)), each with the following payload:
1217-
1218-
| Size | Field | Description |
1219-
|--------|----------|----------------------------------------------------------------------------------------------------------|
1220-
| varies | `count` | Number of transaction references (CompactSize). |
1221-
| varies | `txrefs` | `count` transaction references (see [Transaction References](#transactionreferences)). `SHORTID` references MUST NOT be used. |
1216+
[Records](#records)), each a single transaction reference (see
1217+
[Transaction References](#transactionreferences)) of type `TXID` or `WTXID`;
1218+
each field of a reference is fixed in size for its type. `SHORTID` references
1219+
MUST NOT be used.
12221220

12231221
Subscribes to the contents of the peer's transaction memory pool. The
1224-
responder first sends one or more records that together reference every
1225-
transaction currently in its mempool (the snapshot; a single record with
1226-
`count = 0` is valid and indicates an empty mempool). It then keeps its
1227-
sending direction open, and sends further records referencing transactions as
1228-
they are accepted into its mempool, until the stream or connection ends. The
1229-
requester fetches transactions of interest with `get-tx`.
1222+
responder first sends a record for each transaction currently in its mempool
1223+
(the snapshot; no snapshot records indicate an empty mempool). It then keeps
1224+
its sending direction open, and sends further records referencing
1225+
transactions as they are accepted into its mempool, until the stream or
1226+
connection ends. The requester fetches transactions of interest with
1227+
`get-tx`.
12301228

12311229
This is the one stream type whose response is open-ended (see
12321230
[Request Streams](#requeststreams)): the responder finishing its sending

0 commit comments

Comments
 (0)