ex_wire v0.1.1 ExWire.Sync

This is the heart of our syncing logic. Once we’ve connected to a number of peers via ExWire.PeerSup, we begin to ask for new blocks from those peers. As we receive blocks, we add them to our ExWire.Struct.BlockQueue. If the blocks are confirmed by enough peers, then we verify the block and add it to our block tree.

Note: we do not currently store the block tree, and thus we need to build

  it from genesis each time.

Link to this section Summary

Functions

When were receive a block header, we’ll add it to our block queue. When we receive the corresponding block body, we’ll add that as well

Once we start a sync server, we’ll wait for active peers

Starts a Sync process

Link to this section Functions

Link to this function handle_info(msg, state)

When were receive a block header, we’ll add it to our block queue. When we receive the corresponding block body, we’ll add that as well.

Once we start a sync server, we’ll wait for active peers.

TODO: We do not always want to sync from the genesis.

  We will need to add some "restore state" logic.
Link to this function request_next_block(block_tree)

Starts a Sync process.