multi: enhance logging for debugging peer connection
This commit is contained in:
7 files changed
+42
-20
No files matched your search
@@ -158,6 +158,7 @@ func (c *ChannelGraphBootstrapper) SampleNodeAddrs(numAddrs uint32,
|
|||||||
// We'll merge the ignore map with our currently selected map in order
|
// We'll merge the ignore map with our currently selected map in order
|
||||||
// to ensure we don't return any duplicate nodes.
|
// to ensure we don't return any duplicate nodes.
|
||||||
for n := range ignore {
|
for n := range ignore {
|
||||||
|
log.Tracef("Ignored node %x for bootstrapping", n)
|
||||||
c.tried[n] = struct{}{}
|
c.tried[n] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1744,7 +1744,7 @@ func (lc *LightningChannel) restoreCommitState(
|
|||||||
}
|
}
|
||||||
lc.localCommitChain.addCommitment(localCommit)
|
lc.localCommitChain.addCommitment(localCommit)
|
||||||
|
|
||||||
lc.log.Debugf("starting local commitment: %v",
|
lc.log.Tracef("starting local commitment: %v",
|
||||||
newLogClosure(func() string {
|
newLogClosure(func() string {
|
||||||
return spew.Sdump(lc.localCommitChain.tail())
|
return spew.Sdump(lc.localCommitChain.tail())
|
||||||
}),
|
}),
|
||||||
@@ -1760,7 +1760,7 @@ func (lc *LightningChannel) restoreCommitState(
|
|||||||
}
|
}
|
||||||
lc.remoteCommitChain.addCommitment(remoteCommit)
|
lc.remoteCommitChain.addCommitment(remoteCommit)
|
||||||
|
|
||||||
lc.log.Debugf("starting remote commitment: %v",
|
lc.log.Tracef("starting remote commitment: %v",
|
||||||
newLogClosure(func() string {
|
newLogClosure(func() string {
|
||||||
return spew.Sdump(lc.remoteCommitChain.tail())
|
return spew.Sdump(lc.remoteCommitChain.tail())
|
||||||
}),
|
}),
|
||||||
|
|||||||
+3
-3
@@ -1442,7 +1442,7 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
walletLog.Debugf("Funding tx for ChannelPoint(%v) "+
|
walletLog.Tracef("Funding tx for ChannelPoint(%v) "+
|
||||||
"generated: %v", chanPoint, spew.Sdump(fundingTx))
|
"generated: %v", chanPoint, spew.Sdump(fundingTx))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1589,9 +1589,9 @@ func (l *LightningWallet) handleChanPointReady(req *continueContributionMsg) {
|
|||||||
txsort.InPlaceSort(ourCommitTx)
|
txsort.InPlaceSort(ourCommitTx)
|
||||||
txsort.InPlaceSort(theirCommitTx)
|
txsort.InPlaceSort(theirCommitTx)
|
||||||
|
|
||||||
walletLog.Debugf("Local commit tx for ChannelPoint(%v): %v",
|
walletLog.Tracef("Local commit tx for ChannelPoint(%v): %v",
|
||||||
chanPoint, spew.Sdump(ourCommitTx))
|
chanPoint, spew.Sdump(ourCommitTx))
|
||||||
walletLog.Debugf("Remote commit tx for ChannelPoint(%v): %v",
|
walletLog.Tracef("Remote commit tx for ChannelPoint(%v): %v",
|
||||||
chanPoint, spew.Sdump(theirCommitTx))
|
chanPoint, spew.Sdump(theirCommitTx))
|
||||||
|
|
||||||
// Record newly available information within the open channel state.
|
// Record newly available information within the open channel state.
|
||||||
|
|||||||
+2
-1
@@ -479,7 +479,8 @@ func (p *Brontide) Start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
peerLog.Tracef("Peer %v starting", p)
|
peerLog.Tracef("Peer %v starting with conn[%v->%v]", p,
|
||||||
|
p.cfg.Conn.LocalAddr(), p.cfg.Conn.RemoteAddr())
|
||||||
|
|
||||||
// Fetch and then load all the active channels we have with this remote
|
// Fetch and then load all the active channels we have with this remote
|
||||||
// peer from the database.
|
// peer from the database.
|
||||||
|
|||||||
@@ -521,3 +521,11 @@ func (m *mockMessageConn) ReadNextHeader() (uint32, error) {
|
|||||||
func (m *mockMessageConn) ReadNextBody(buf []byte) ([]byte, error) {
|
func (m *mockMessageConn) ReadNextBody(buf []byte) ([]byte, error) {
|
||||||
return m.curReadMessage, nil
|
return m.curReadMessage, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mockMessageConn) RemoteAddr() net.Addr {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mockMessageConn) LocalAddr() net.Addr {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -125,9 +125,8 @@ func (r *ChannelRouter) notifyTopologyChange(topologyDiff *TopologyChange) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Sending topology notification to %v clients %v",
|
log.Tracef("Sending topology notification to %v clients %v",
|
||||||
numClients,
|
numClients, newLogClosure(func() string {
|
||||||
newLogClosure(func() string {
|
|
||||||
return spew.Sdump(topologyDiff)
|
return spew.Sdump(topologyDiff)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2450,7 +2450,11 @@ const bootstrapBackOffCeiling = time.Minute * 5
|
|||||||
// until the target number of peers has been reached. This ensures that nodes
|
// until the target number of peers has been reached. This ensures that nodes
|
||||||
// receive an up to date network view as soon as possible.
|
// receive an up to date network view as soon as possible.
|
||||||
func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{},
|
func (s *server) initialPeerBootstrap(ignore map[autopilot.NodeID]struct{},
|
||||||
numTargetPeers uint32, bootstrappers []discovery.NetworkPeerBootstrapper) {
|
numTargetPeers uint32,
|
||||||
|
bootstrappers []discovery.NetworkPeerBootstrapper) {
|
||||||
|
|
||||||
|
srvrLog.Debugf("Init bootstrap with targetPeers=%v, bootstrappers=%v, "+
|
||||||
|
"ignore=%v", numTargetPeers, len(bootstrappers), len(ignore))
|
||||||
|
|
||||||
// We'll start off by waiting 2 seconds between failed attempts, then
|
// We'll start off by waiting 2 seconds between failed attempts, then
|
||||||
// double each time we fail until we hit the bootstrapBackOffCeiling.
|
// double each time we fail until we hit the bootstrapBackOffCeiling.
|
||||||
@@ -2775,6 +2779,9 @@ func (s *server) establishPersistentConnections() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srvrLog.Debugf("Establishing %v persistent connections on start",
|
||||||
|
len(nodeAddrsMap))
|
||||||
|
|
||||||
// Acquire and hold server lock until all persistent connection requests
|
// Acquire and hold server lock until all persistent connection requests
|
||||||
// have been recorded and sent to the connection manager.
|
// have been recorded and sent to the connection manager.
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
@@ -3093,10 +3100,10 @@ func (s *server) InboundPeerConnected(conn net.Conn) {
|
|||||||
|
|
||||||
// If we already have an outbound connection to this peer, then ignore
|
// If we already have an outbound connection to this peer, then ignore
|
||||||
// this new connection.
|
// this new connection.
|
||||||
if _, ok := s.outboundPeers[pubStr]; ok {
|
if p, ok := s.outboundPeers[pubStr]; ok {
|
||||||
srvrLog.Debugf("Already have outbound connection for %x, "+
|
srvrLog.Debugf("Already have outbound connection for %v, "+
|
||||||
"ignoring inbound connection",
|
"ignoring inbound connection from local=%v, remote=%v",
|
||||||
nodePub.SerializeCompressed())
|
p, conn.LocalAddr(), conn.RemoteAddr())
|
||||||
|
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return
|
return
|
||||||
@@ -3105,8 +3112,9 @@ func (s *server) InboundPeerConnected(conn net.Conn) {
|
|||||||
// If we already have a valid connection that is scheduled to take
|
// If we already have a valid connection that is scheduled to take
|
||||||
// precedence once the prior peer has finished disconnecting, we'll
|
// precedence once the prior peer has finished disconnecting, we'll
|
||||||
// ignore this connection.
|
// ignore this connection.
|
||||||
if _, ok := s.scheduledPeerConnection[pubStr]; ok {
|
if p, ok := s.scheduledPeerConnection[pubStr]; ok {
|
||||||
srvrLog.Debugf("Ignoring connection, peer already scheduled")
|
srvrLog.Debugf("Ignoring connection from %v, peer %v already "+
|
||||||
|
"scheduled", conn.RemoteAddr(), p)
|
||||||
conn.Close()
|
conn.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -3179,10 +3187,10 @@ func (s *server) OutboundPeerConnected(connReq *connmgr.ConnReq, conn net.Conn)
|
|||||||
|
|
||||||
// If we already have an inbound connection to this peer, then ignore
|
// If we already have an inbound connection to this peer, then ignore
|
||||||
// this new connection.
|
// this new connection.
|
||||||
if _, ok := s.inboundPeers[pubStr]; ok {
|
if p, ok := s.inboundPeers[pubStr]; ok {
|
||||||
srvrLog.Debugf("Already have inbound connection for %x, "+
|
srvrLog.Debugf("Already have inbound connection for %v, "+
|
||||||
"ignoring outbound connection",
|
"ignoring outbound connection from local=%v, remote=%v",
|
||||||
nodePub.SerializeCompressed())
|
p, conn.LocalAddr(), conn.RemoteAddr())
|
||||||
|
|
||||||
if connReq != nil {
|
if connReq != nil {
|
||||||
s.connMgr.Remove(connReq.ID())
|
s.connMgr.Remove(connReq.ID())
|
||||||
@@ -3303,6 +3311,8 @@ func (s *server) cancelConnReqs(pubStr string, skip *uint64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, connReq := range connReqs {
|
for _, connReq := range connReqs {
|
||||||
|
srvrLog.Tracef("Canceling %s:", connReqs)
|
||||||
|
|
||||||
// Atomically capture the current request identifier.
|
// Atomically capture the current request identifier.
|
||||||
connID := connReq.ID()
|
connID := connReq.ID()
|
||||||
|
|
||||||
@@ -3998,6 +4008,9 @@ func (s *server) connectToPeer(addr *lnwire.NetAddress,
|
|||||||
|
|
||||||
close(errChan)
|
close(errChan)
|
||||||
|
|
||||||
|
srvrLog.Tracef("Brontide dialer made local=%v, remote=%v",
|
||||||
|
conn.LocalAddr(), conn.RemoteAddr())
|
||||||
|
|
||||||
s.OutboundPeerConnected(nil, conn)
|
s.OutboundPeerConnected(nil, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user