Skip to content

Commit

Permalink
Fix IPv6 handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheatfate committed Oct 4, 2024
1 parent 170a196 commit 69cdcf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions beacon_chain/rpc/rest_node_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ proc getLastSeenAddress(node: BeaconNode, id: PeerId): string =
if isUDP or isTCP:
# TODO (cheatfate): We match TCP here because `nim-libp2p` do not have
# QUIC support yet. So we give TCP addresses priority.
let boost = if isUDP: 100 else 0
let boost = if isUDP: 100 else: 0
if IP4.matchPartial(address):
let address4 =
address.getProtocolArgument(multiCodec("ip4")).valueOr:
Expand All @@ -161,7 +161,7 @@ proc getLastSeenAddress(node: BeaconNode, id: PeerId): string =
let address6 =
address.getProtocolArgument(multiCodec("ip6")).valueOr:
continue
var ta6 = TransportAddress(family: AddressFamily.IPv4)
var ta6 = TransportAddress(family: AddressFamily.IPv6)
ta6.address_v6[0 .. 15] = address6[0 .. 15]
if ta6.isLoopback():
(address, boost + 8)
Expand Down

0 comments on commit 69cdcf3

Please sign in to comment.