Description
The conditions we use to decide if a peer is advanced, synced or behind, or relevant to the chain to begin with, are split over a couple of different parts of the code and it's not entirely clear how they get along. We should centralize this logic for maintainability and to reason about this more easily.
Parts that I identify:
- We have the
process_status function in the router's processor. This function for some cases disconnects a peer, for others it informs the sync manager and for other ("naive" peer it does nothing else). This last part seems interesting since the sync manages does have the logic to deal with behind peers.
- We also have the
PeerSyncInfo where we get most of the sync status of a peer if it gets to the sync manager.
- We have additional logic in the
SyncManager for when a peer is said to be Advanced wrt to the PeerSyncInfo
Version
master 0a0f4da