github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/internal/blocksync/doc.go (about) 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 6 In order for a full node to successfully participate in consensus, it must have 7 the latest view of state. The blocksync protocol is a mechanism in which peers 8 may exchange and gossip entire blocks with one another, in a request/response 9 type model, until they've successfully synced to the latest head block. Once 10 succussfully synced, the full node can switch to an active role in consensus and 11 will no longer blocksync and thus no longer run the blocksync process. 12 13 Note, the blocksync reactor Service gossips entire block and relevant data such 14 that each receiving peer may construct the entire view of the blocksync state. 15 16 There is currently only one version of the blocksync reactor Service 17 that is battle-tested, but whose test coverage is lacking and is not 18 formally verified. 19 20 The v0 blocksync reactor Service has one p2p channel, BlockchainChannel. This 21 channel is responsible for handling messages that both request blocks and respond 22 to block requests from peers. For every block request from a peer, the reactor 23 will execute respondToPeer which will fetch the block from the node's state store 24 and respond to the peer. For every block response, the node will add the block 25 to its pool via AddBlock. 26 27 Internally, v0 runs a poolRoutine that constantly checks for what blocks it needs 28 and requests them. The poolRoutine is also responsible for taking blocks from the 29 pool, saving and executing each block. 30 */ 31 package blocksync