You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.8 KiB

  1. ---
  2. order: 2
  3. ---
  4. # Block Sync
  5. ## Channel
  6. Block sync has one channel.
  7. | Name | Number |
  8. |-------------------|--------|
  9. | BlockchainChannel | 64 |
  10. ## Message Types
  11. There are multiple message types for Block Sync
  12. ### BlockRequest
  13. BlockRequest asks a peer for a block at the height specified.
  14. | Name | Type | Description | Field Number |
  15. |--------|-------|---------------------------|--------------|
  16. | Height | int64 | Height of requested block | 1 |
  17. ### NoBlockResponse
  18. NoBlockResponse notifies the peer requesting a block that the node does not contain it.
  19. | Name | Type | Description | Field Number |
  20. |--------|-------|---------------------------|--------------|
  21. | Height | int64 | Height of requested block | 1 |
  22. ### BlockResponse
  23. BlockResponse contains the block requested.
  24. | Name | Type | Description | Field Number |
  25. |-------|----------------------------------------------|-----------------|--------------|
  26. | Block | [Block](../../core/data_structures.md#block) | Requested Block | 1 |
  27. ### StatusRequest
  28. StatusRequest is an empty message that notifies the peer to respond with the highest and lowest blocks it has stored.
  29. > Empty message.
  30. ### StatusResponse
  31. StatusResponse responds to a peer with the highest and lowest block stored.
  32. | Name | Type | Description | Field Number |
  33. |--------|-------|-------------------------------------------------------------------|--------------|
  34. | Height | int64 | Current Height of a node | 1 |
  35. | base | int64 | First known block, if pruning is enabled it will be higher than 1 | 1 |
  36. ### Message
  37. Message is a [`oneof` protobuf type](https://developers.google.com/protocol-buffers/docs/proto#oneof). The `oneof` consists of five messages.
  38. | Name | Type | Description | Field Number |
  39. |-------------------|----------------------------------|--------------------------------------------------------------|--------------|
  40. | block_request | [BlockRequest](#blockrequest) | Request a block from a peer | 1 |
  41. | no_block_response | [BlockRequest](#noblockresponse) | Response saying it doe snot have the requested block | 2 |
  42. | block_response | [BlockRequest](#blockresponse) | Response with requested block | 3 |
  43. | status_request | [BlockRequest](#statusrequest) | Request the highest and lowest block numbers from a peer | 4 |
  44. | status_response | [BlockRequest](#statusresponse) | Response with the highest and lowest block numbers the store | 5 |