diff --git a/peers/app_request_network.go b/peers/app_request_network.go index 19a31111..4aba983d 100644 --- a/peers/app_request_network.go +++ b/peers/app_request_network.go @@ -14,7 +14,6 @@ import ( "github.com/ava-labs/avalanchego/network" snowVdrs "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/utils/constants" - "github.com/ava-labs/avalanchego/utils/ips" "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/set" "github.com/ava-labs/avalanchego/vms/platformvm/warp" @@ -176,20 +175,14 @@ func (n *AppRequestNetwork) ConnectPeers(nodeIDs set.Set[ids.NodeID]) set.Set[id zap.Error(err), ) } else if nodeIDs.Contains(apiNodeID) { - if apiNodeIP, err := n.infoAPI.GetNodeIP(context.Background()); err != nil { + if apiNodeIPPort, err := n.infoAPI.GetNodeIP(context.Background()); err != nil { n.logger.Error( "Failed to get API Node IP", zap.Error(err), ) - } else if ipPort, err := ips.ParseAddrPort(apiNodeIP); err != nil { - n.logger.Error( - "Failed to parse API Node IP", - zap.String("nodeIP", apiNodeIP), - zap.Error(err), - ) } else { trackedNodes.Add(apiNodeID) - n.Network.ManuallyTrack(apiNodeID, ipPort) + n.Network.ManuallyTrack(apiNodeID, apiNodeIPPort) } } diff --git a/peers/info_client.go b/peers/info_client.go index 823242da..53c5dd6e 100644 --- a/peers/info_client.go +++ b/peers/info_client.go @@ -5,6 +5,7 @@ package peers import ( "context" + "net/netip" "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/ids" @@ -47,9 +48,8 @@ func (i *InfoAPI) GetNodeID(ctx context.Context) (ids.NodeID, *signer.ProofOfPos return i.client.GetNodeID(ctx, i.options...) } -func (i *InfoAPI) GetNodeIP(ctx context.Context) (string, error) { - addrPort, err := i.client.GetNodeIP(ctx, i.options...) - return addrPort.Addr().String(), err +func (i *InfoAPI) GetNodeIP(ctx context.Context) (netip.AddrPort, error) { + return i.client.GetNodeIP(ctx, i.options...) } func (i *InfoAPI) GetNodeVersion(ctx context.Context) (*info.GetNodeVersionReply, error) {