Skip to main content

read_group_order

Function read_group_order 

Source
fn read_group_order(buf: &mut impl Buf) -> Result<GroupOrder, CodecError>
Expand description

Read a Group Order from a message that lets the publisher choose.

Every figure draws this field as a single byte, and the values are 0x1 Ascending, 0x2 Descending, and 0x0 for “the original publisher’s Group Order SHOULD be used”. “Values larger than 0x2 are a protocol error.”

Reading it as a varint instead is invisible for all three legal values — each is a single byte below 64, where the two encodings coincide — and diverges on everything a peer may send that is not legal. A two-byte varint holding 1 passes as Ascending and shifts every field after it, while the declared message length still adds up.