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.

31 lines
1.6 KiB

  1. /*
  2. Package blocksync implements two versions of a reactor Service that are
  3. responsible for block propagation and gossip between peers. This mechanism was
  4. formerly known as fast-sync.
  5. In order for a full node to successfully participate in consensus, it must have
  6. the latest view of state. The blocksync protocol is a mechanism in which peers
  7. may exchange and gossip entire blocks with one another, in a request/response
  8. type model, until they've successfully synced to the latest head block. Once
  9. succussfully synced, the full node can switch to an active role in consensus and
  10. will no longer blocksync and thus no longer run the blocksync process.
  11. Note, the blocksync reactor Service gossips entire block and relevant data such
  12. that each receiving peer may construct the entire view of the blocksync state.
  13. There is currently only one version of the blocksync reactor Service
  14. that is battle-tested, but whose test coverage is lacking and is not
  15. formally verified.
  16. The v0 blocksync reactor Service has one p2p channel, BlockchainChannel. This
  17. channel is responsible for handling messages that both request blocks and respond
  18. to block requests from peers. For every block request from a peer, the reactor
  19. will execute respondToPeer which will fetch the block from the node's state store
  20. and respond to the peer. For every block response, the node will add the block
  21. to its pool via AddBlock.
  22. Internally, v0 runs a poolRoutine that constantly checks for what blocks it needs
  23. and requests them. The poolRoutine is also responsible for taking blocks from the
  24. pool, saving and executing each block.
  25. */
  26. package blocksync