diff --git a/BSP.markdown b/BSP.markdown index 75cffbe..f21e50c 100644 --- a/BSP.markdown +++ b/BSP.markdown @@ -14,14 +14,14 @@ Each channel has a unique identifier hash_len bytes long. This identifier is sup ### Message format -Each message consists of one or more blocks, each block_len bytes long, except the last, which may be shorter. The blocks form the leaves of a binary hash tree. Each parent node consists of the concatenated hashes of its children. If the number of blocks is not a power of two, some parent nodes will only have one child. +Each message consists of one or more blocks, block_len bytes long, except the last, which may be shorter. The blocks form the leaves of a binary hash tree. Each parent node consists of the concatenated hashes of its children. If the number of blocks is not a power of two, some parent nodes will only have one child. The message's unique identifier is calculated by hashing a message header concatenated with the root hash of the tree. The message header consists of the channel identifier, a timestamp, the message length and the message type. -The timestamp is a 64-bit integer representing seconds since the Unix epoch. (All integers in BSP are big-endian and signed.) The message length is a 64-bit integer representing the length of the message in bytes. The message type is a single byte that is supplied by the application and not interpreted by BSP. +The timestamp is a 64-bit integer representing seconds since the Unix epoch. (All integers in BSP are big-endian and signed.) The message length is a 64-bit integer representing the length of the message in bytes. The message type is a single byte that is supplied by the application and is not interpreted by BSP. Each block also has a unique identifier, which is calculated by hashing the message header concatenated with a block header and the hash of the block itself. The block header consists of the block number and a list of hashes called the path. -The block number is a 64-bit integer starting from zero for the first block of the message. The path contains the hashes of the block's ancestors' siblings in the hash tree. If the number of blocks is not a power of two, some ancestors may not have siblings. The positions of any nonexistent siblings can be calculated from the message length and the block number. +The block number is a 64-bit integer starting from zero for the first block of the message. The path contains the hashes of the siblings of the block's ancestors in the hash tree. If the number of blocks is not a power of two, some ancestors may not have siblings. The positions of any nonexistent siblings can be calculated from the message length and the block number. -A block accompanied by its message and block headers is called a portable block. A portable block is valid if the message and block headers are consistent with each other and with the length of the block. A portable block contains all the information needed to calculate the message identifier. Any valid portable blocks that produce the same message identifier are guaranteed to be consistent with each other. This makes it possible to synchronise messages a block at a time. +A block accompanied by its message and block headers is called a portable block. A portable block is valid if the message and block headers are consistent with each other and with the length of the block. A valid portable block contains all the information needed to calculate the message identifier. Any valid portable blocks that produce the same message identifier are guaranteed to be consistent with each other. This makes it possible to synchronise messages a block at a time.