From 4634db4f80804835eb902960df1067d71ad6c71b Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 22 Jan 2017 14:34:35 -0800 Subject: [PATCH] lnd: use the default peer port when launching persistent conn goroutines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a slight bug in the deamon. Previously we would store the *net.TCPAddr that we observed when we either connected out to the peer, or the peer connected to us. When making an outgoing connection the host+port combination would be correct, but when responding to an incoming connection, the port assigned after the TCP handshake would be stored in the database. This would cause many goroutines to repeatedly fail connections within the connmgr. Atm within the connmgr, it isn’t possible to cancel requests for failed connection even after we’ve already established a connection. This commit fixes that issues by using the default peer port when attempting to establish outbound connections to our channel peers. --- server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 5a63a0de..a538dbfa 100644 --- a/server.go +++ b/server.go @@ -206,6 +206,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier, for _, node := range linkNodes { // Create a wrapper address which couples the IP and the pubkey // so the brontide authenticated connection can be established. + node.Addresses[0].Port = defaultPeerPort lnAddr := &lnwire.NetAddress{ IdentityKey: node.IdentityPub, Address: node.Addresses[0], @@ -215,8 +216,8 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier, "peer %v", lnAddr) // Send the persistent connection request to the connection - // manager, saving the request itself so we can - // cancel/restart the process as needed. + // manager, saving the request itself so we can cancel/restart + // the process as needed. connReq := &connmgr.ConnReq{ Addr: lnAddr, Permanent: true,