koinos / koinos-p2p

The p2p microservice orchestrates the distribution of blocks and transactions between peers.
MIT License
6 stars 4 forks source link

Sync Manager #45

Closed mvandeberg closed 3 years ago

mvandeberg commented 3 years ago

Implement the sync manager

Sync Manager Algorithm: Connect to N peers (protocol contains chain id check irreversible fork check) Get head block for each peer Target sync block is (min(peer_head_blocks) - my_head_block) / 2 (perhaps maximum of 100k) For each peer, request block id at target sync block height, separating peers in to different forks depending on response For each fork, make batch requests to get caught up to head block id at height for that fork If our node is now within delta D blocks of peer, switch it to gossip mode Repeat until all peers are in gossip mode

Blocked on #44