Block Sync
Channel
Block sync has one channel.
| Name | Number |
|---|---|
| BlockchainChannel | 64 |
Message Types
There are multiple message types for Block Sync
BlockRequest
BlockRequest asks a peer for a block at the height specified.
| Name | Type | Description | Field Number |
|---|---|---|---|
| Height | int64 | Height of requested block | 1 |
NoBlockResponse
NoBlockResponse notifies the peer requesting a block that the node does not contain it.
| Name | Type | Description | Field Number |
|---|---|---|---|
| Height | int64 | Height of requested block | 1 |
BlockResponse
BlockResponse contains the block requested and its commit.
| Name | Type | Description | Field Number |
|---|---|---|---|
| Block | bytes | Requested Block, serialized as it was committed: the bytes of its parts, in order. On the wire this is the same as an embedded Block. | 1 |
| Commit | Commit | Commit for the requested block | 2 |
The receiver cuts Block into parts of 64kB, the last one shorter, and checks
the part set header it computes against the one in the commit's block ID.
Block is served as stored, because decoding and re-encoding the block can
change its bytes.
Block sync rebuilds only this standard cut, which honest proposers use.
Consensus does not require it yet: it accepts parts of other sizes, and proofs
of a tree larger than the header counts. A block committed that way fails the
commit check (wrong block ID) whichever peer serves it, and block sync does
not get past its height.
StatusRequest
StatusRequest is an empty message that notifies the peer to respond with the highest and lowest blocks it has stored.
Empty message.
StatusResponse
StatusResponse responds to a peer with the highest and lowest block stored.
| Name | Type | Description | Field Number |
|---|---|---|---|
| Height | int64 | Current Height of a node | 1 |
| base | int64 | First known block, if pruning is enabled it will be higher than 1 | 1 |
Message
Message is a oneof protobuf type. The oneof consists of five messages.
| Name | Type | Description | Field Number |
|---|---|---|---|
| block_request | BlockRequest | Request a block from a peer | 1 |
| no_block_response | NoBlockResponse | Response saying it doe snot have the requested block | 2 |
| block_response | BlockResponse | Response with requested block | 3 |
| status_request | StatusRequest | Request the highest and lowest block numbers from a peer | 4 |
| status_response | StatusResponse | Response with the highest and lowest block numbers the store | 5 |