ouroboros-network-0.16.1.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.PeerSelection.Governor.KnownPeers

Synopsis

Documentation

belowTarget Source #

Arguments

∷ (MonadAsync m, MonadTimer m, Ord peeraddr, Hashable peeraddr) 
PeerSelectionActions peeraddr peerconn m 
Time

blocked at

Map peeraddr PeerSharing 
MkGuardedDecision peeraddr peerconn m 

If we are below the target of known peers we flip a coin to either get new peers from:

  • inbound connections; or
  • peer share (if we are above the peer share request threshold).

It should be noted if the node is in bootstrap mode (i.e. in a sensitive state) then this monitoring action will be disabled.

aboveTarget ∷ (MonadSTM m, Ord peeraddr, HasCallStack) ⇒ MkGuardedDecision peeraddr peerconn m Source #

If we are above the target of known peers (i.e. cold, warm and hot combined), we drop some of the cold peers but we protect the targetNumberOfRootPeers (from combined sets of local and public root peers). policyPickColdPeersToForget policy is used to pick the peers.