From 7547a3efe1b34eb8ac83879140243346e96ba997 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 26 May 2020 19:49:25 +0300 Subject: [PATCH] network: minor code refactoring We need to handle IPv6 addresses correctly and net.JoinHostPort takes it into account. --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 6830c4612..31f591a95 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -149,7 +149,7 @@ func NewServer(config ServerConfig, chain blockchainer.Blockchainer, log *zap.Lo s.AttemptConnPeers = defaultAttemptConnPeers } - s.transport = NewTCPTransport(s, fmt.Sprintf("%s:%d", config.Address, config.Port), s.log) + s.transport = NewTCPTransport(s, net.JoinHostPort(config.Address, strconv.Itoa(int(config.Port))), s.log) s.discovery = NewDefaultDiscovery( s.DialTimeout, s.transport,