lnd: use the default peer port when launching persistent conn goroutines
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.
This commit is contained in:
parent
f623729b64
commit
4634db4f80
@ -206,6 +206,7 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
for _, node := range linkNodes {
|
for _, node := range linkNodes {
|
||||||
// Create a wrapper address which couples the IP and the pubkey
|
// Create a wrapper address which couples the IP and the pubkey
|
||||||
// so the brontide authenticated connection can be established.
|
// so the brontide authenticated connection can be established.
|
||||||
|
node.Addresses[0].Port = defaultPeerPort
|
||||||
lnAddr := &lnwire.NetAddress{
|
lnAddr := &lnwire.NetAddress{
|
||||||
IdentityKey: node.IdentityPub,
|
IdentityKey: node.IdentityPub,
|
||||||
Address: node.Addresses[0],
|
Address: node.Addresses[0],
|
||||||
@ -215,8 +216,8 @@ func newServer(listenAddrs []string, notifier chainntnfs.ChainNotifier,
|
|||||||
"peer %v", lnAddr)
|
"peer %v", lnAddr)
|
||||||
|
|
||||||
// Send the persistent connection request to the connection
|
// Send the persistent connection request to the connection
|
||||||
// manager, saving the request itself so we can
|
// manager, saving the request itself so we can cancel/restart
|
||||||
// cancel/restart the process as needed.
|
// the process as needed.
|
||||||
connReq := &connmgr.ConnReq{
|
connReq := &connmgr.ConnReq{
|
||||||
Addr: lnAddr,
|
Addr: lnAddr,
|
||||||
Permanent: true,
|
Permanent: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user