Skip to content

Commit

Permalink
p2p-governor: public root peers
Browse files Browse the repository at this point in the history
Public root peers are a subset of known peers. Public and local roots
might overlapp (in which case the peer will be recorded
as local).  For that reason public roots is a subset of known peers
which are either local or public.

TODO: requires prop_governor_livelock
  • Loading branch information
coot committed Oct 16, 2020
1 parent 0ff21c0 commit 5eeabd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Expand Up @@ -300,9 +300,12 @@ invariantPeerSelectionState PeerSelectionState{..} =
(KnownPeers.toMap knownPeers)

-- The publicRootPeers are a subset of the knownPeers,
-- and with correct source info in the knownPeers.
-- and with correct source info in the knownPeers (either
-- 'PeerSroucePublicRoot' or 'PeerSourceLocalRoot', as local and public
-- root peers might overlap).
&& Map.isSubmapOfBy (\_ KnownPeerInfo {knownPeerSource} ->
knownPeerSource == PeerSourcePublicRoot)
knownPeerSource == PeerSourcePublicRoot
|| knownPeerSource == PeerSourceLocalRoot)
(Map.fromSet (const ()) publicRootPeers)
(KnownPeers.toMap knownPeers)

Expand Down
10 changes: 10 additions & 0 deletions ouroboros-network/test/Ouroboros/Network/PeerSelection/Test.hs

Large diffs are not rendered by default.

0 comments on commit 5eeabd5

Please sign in to comment.