Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
peer-selection: added publicly visible OutboundConnectionsState
Consensus needs to know if the outbound governor is connected just to local roots or any external roots. Diffusion takes a callback `OutboundConnectionsState -> STM m ()` used by the outbound governor. Co-authored-by: Armando Santos (@bolt12) Co-authored-by: Marcin Szamotulski (@coot)
- Loading branch information
Showing
15 changed files
with
317 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
ouroboros-network-api/src/Ouroboros/Network/PeerSelection/LocalRootPeers.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{-# LANGUAGE DeriveGeneric #-} | ||
|
||
module Ouroboros.Network.PeerSelection.LocalRootPeers (OutboundConnectionsState (..)) where | ||
|
||
import GHC.Generics | ||
import NoThunks.Class | ||
|
||
data OutboundConnectionsState = | ||
TrustedStateWithExternalPeers | ||
-- ^ | ||
-- * /in bootstrap mode/: connected only to trusted local peers and at least | ||
-- one bootstrap peer. | ||
-- * /in genesis mode/: meeting target of active big ledger peers, ledger | ||
-- state judgement must be `TooOld`. | ||
|
||
| EnteringTrustedStateWithExternalPeers | ||
-- ^ entering trusted state with eternal peers. | ||
-- | ||
-- * /in bootstrap mode/: `requiredBootstrapPeers` returns `True` and has | ||
-- at least on bootstrap peer. | ||
-- * /in genesis mode/: ledger state judgement returns `TooOld` | ||
|
||
| HiddenRelayOrBP | ||
-- ^ A node is classified as a hidden relay or a BP if it is configured so | ||
-- that it can only have a chance to be connected to local roots. This is | ||
-- true in one of the two ways: | ||
-- | ||
-- * it's configured with `DontUseBootstrapPeers` and `DontUseLedgerPeers`; or | ||
-- * the targets are set so the node can only be connected to local roots. | ||
|
||
| UntrustedState | ||
-- ^ catch all other cases | ||
deriving (Eq, Show, Generic) | ||
|
||
instance NoThunks OutboundConnectionsState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.