Skip to content

Commit 9772d20

Browse files
cootjasagredo
authored andcommitted
SRV support
1 parent 4455889 commit 9772d20

File tree

1 file changed

+10
-4
lines changed
  • ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger

1 file changed

+10
-4
lines changed

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,18 @@ instance SL.EraCertState era => LedgerSupportsPeerSelection (ShelleyBlock proto
7070
(SJust ipv6)
7171
) =
7272
Just $ RelayAccessAddress (IPv6 ipv6) (fromIntegral port)
73+
-- no IP address or no port number
74+
relayToRelayAccessPoint (SL.SingleHostAddr SNothing _ _) = Nothing
75+
relayToRelayAccessPoint (SL.SingleHostAddr _ SNothing _) = Nothing
7376
relayToRelayAccessPoint (SL.SingleHostName (SJust (Port port)) dnsName) =
7477
Just $ RelayAccessDomain (encodeUtf8 $ dnsToText dnsName) (fromIntegral port)
75-
relayToRelayAccessPoint _ =
76-
-- This could be an unsupported relay (SRV records) or an unusable
77-
-- relay such as a relay with an IP address but without a port number.
78-
Nothing
78+
-- srv support: either `SingleHostName` without port number or
79+
-- `MultiHostName`
80+
81+
relayToRelayAccessPoint (SL.SingleHostName SNothing dnsName) =
82+
Just $ RelayAccessSRVDomain (encodeUtf8 $ dnsToText dnsName)
83+
relayToRelayAccessPoint (SL.MultiHostName dnsName) =
84+
Just $ RelayAccessSRVDomain (encodeUtf8 $ dnsToText dnsName)
7985

8086
-- \| Note that a stake pool can have multiple registered relays
8187
pparamsRelayAccessPoints ::

0 commit comments

Comments
 (0)