Skip to content

Centralize the conditions to decide if a peer is relevant and their sync status #1856

@divagant-martian

Description

@divagant-martian

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:

  1. 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.
  2. We also have the PeerSyncInfo where we get most of the sync status of a peer if it gets to the sync manager.
  3. We have additional logic in the SyncManager for when a peer is said to be Advanced wrt to the PeerSyncInfo

Version

master 0a0f4da

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions