I can sync to the peer if my LIB is an ancestor of their head block. (Note: this is already a supported query of block store)
Begin requesting blocks from my LIB to their head block
If I have one peer, sync is straight forward.
This needs to be generalized to multiple peers and potentially multiple forks.
Let's not worry about syncing to a peer's minority fork. If the peer changes forks, the peer handler will catch this change and be able to make progress on the new fork. With many peers it is unlikely that we will miss a minority fork from all peers. If a minority fork takes over, peers will switch and we will begin to sync the fork.
Restructure the peer handler to be able to answer the questionm "Can make progress on this peer?" It is the responsibility of the peer handler to make progress on its peer. (This removes the need for the topology cache)
This simple design works and guarantees progress on all peer forks. It is inefficient in that peers can request duplicate blocks from one another. As an optimization, we can add in a management layer that coordinates work between peers to try to prevent duplicate requests. Duplicate requests are not the enemy. There should be a best effort to prevent them, but their total elimination is not a design goal.
For an individual peer:
If I have one peer, sync is straight forward.
This needs to be generalized to multiple peers and potentially multiple forks.
Let's not worry about syncing to a peer's minority fork. If the peer changes forks, the peer handler will catch this change and be able to make progress on the new fork. With many peers it is unlikely that we will miss a minority fork from all peers. If a minority fork takes over, peers will switch and we will begin to sync the fork.
Restructure the peer handler to be able to answer the questionm "Can make progress on this peer?" It is the responsibility of the peer handler to make progress on its peer. (This removes the need for the topology cache)
This simple design works and guarantees progress on all peer forks. It is inefficient in that peers can request duplicate blocks from one another. As an optimization, we can add in a management layer that coordinates work between peers to try to prevent duplicate requests. Duplicate requests are not the enemy. There should be a best effort to prevent them, but their total elimination is not a design goal.