diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 7cb3ce62..50bd723b 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1332,7 +1332,7 @@ type LightningChannel struct { cowg sync.WaitGroup wg sync.WaitGroup - quit chan struct{} + quit chan struct{} } // NewLightningChannel creates a new, active payment channel given an @@ -3184,7 +3184,6 @@ func (lc *LightningChannel) ProcessChanSyncMsg( // revocation, but also initiate a state transition to re-sync // them. if !lc.FullySynced() { - commitSig, htlcSigs, err := lc.SignNextCommitment() switch { diff --git a/server.go b/server.go index 322e5011..80357229 100644 --- a/server.go +++ b/server.go @@ -1545,6 +1545,9 @@ func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq, addr := conn.RemoteAddr() pubKey := brontideConn.RemotePub() + srvrLog.Infof("finalizing connection to %x, inbound=%v", + pubKey.SerializeCompressed(), inbound) + peerAddr := &lnwire.NetAddress{ IdentityKey: pubKey, Address: addr, @@ -1641,12 +1644,6 @@ func (s *server) InboundPeerConnected(conn net.Conn) { srvrLog.Infof("New inbound connection from %v", conn.RemoteAddr()) - // Cancel all pending connection requests, we either already have an - // outbound connection, or this incoming connection will become our - // primary connection. The incoming connection will not have an - // associated connection request, so we pass nil. - s.cancelConnReqs(pubStr, nil) - // Check to see if we already have a connection with this peer. If so, // we may need to drop our existing connection. This prevents us from // having duplicate connections to the same peer. We forgo adding a @@ -1657,6 +1654,7 @@ func (s *server) InboundPeerConnected(conn net.Conn) { case ErrPeerNotConnected: // We were unable to locate an existing connection with the // target peer, proceed to connect. + s.cancelConnReqs(pubStr, nil) s.peerConnected(conn, nil, true) case nil: @@ -1678,6 +1676,8 @@ func (s *server) InboundPeerConnected(conn net.Conn) { srvrLog.Debugf("Disconnecting stale connection to %v", connectedPeer) + s.cancelConnReqs(pubStr, nil) + // Remove the current peer from the server's internal state and // signal that the peer termination watcher does not need to // execute for this peer.