@@ -2195,7 +2195,7 @@ func (c cleaner) add(cleanup func() error) cleaner {
2195
2195
func (c cleaner ) run () {
2196
2196
for i := len (c ) - 1 ; i >= 0 ; i -- {
2197
2197
if err := c [i ](); err != nil {
2198
- srvrLog .Infof ("Cleanup failed: %v" , err )
2198
+ srvrLog .Errorf ("Cleanup failed: %v" , err )
2199
2199
}
2200
2200
}
2201
2201
}
@@ -2498,7 +2498,11 @@ func (s *server) Start() error {
2498
2498
// brontide.NewListener() is called in newServer. This means
2499
2499
// that we are actually listening and partially accepting
2500
2500
// inbound connections even before the connMgr starts.
2501
+ //
2502
+ // TODO(yy): move the log into the connMgr's `Start` method.
2503
+ srvrLog .Info ("connMgr starting..." )
2501
2504
s .connMgr .Start ()
2505
+ srvrLog .Debug ("connMgr started" )
2502
2506
2503
2507
// If peers are specified as a config option, we'll add those
2504
2508
// peers first.
@@ -2540,6 +2544,9 @@ func (s *server) Start() error {
2540
2544
// Subscribe to NodeAnnouncements that advertise new addresses
2541
2545
// our persistent peers.
2542
2546
if err := s .updatePersistentPeerAddrs (); err != nil {
2547
+ srvrLog .Errorf ("Failed to update persistent peer " +
2548
+ "addr: %v" , err )
2549
+
2543
2550
startErr = err
2544
2551
return
2545
2552
}
@@ -2551,12 +2558,15 @@ func (s *server) Start() error {
2551
2558
// to ensure we don't reconnect to any nodes we no longer have
2552
2559
// open channels with.
2553
2560
if err := s .chanStateDB .PruneLinkNodes (); err != nil {
2561
+ srvrLog .Errorf ("Failed to prune link nodes: %v" , err )
2562
+
2554
2563
startErr = err
2555
2564
return
2556
2565
}
2566
+
2557
2567
if err := s .establishPersistentConnections (); err != nil {
2558
- startErr = err
2559
- return
2568
+ srvrLog . Errorf ( "Failed to establish persistent " +
2569
+ "connections: %v" , err )
2560
2570
}
2561
2571
2562
2572
// setSeedList is a helper function that turns multiple DNS seed
@@ -3535,8 +3545,9 @@ func (s *server) establishPersistentConnections() error {
3535
3545
// the reconnection port to the default peer port.
3536
3546
linkNodes , err := s .chanStateDB .LinkNodeDB ().FetchAllLinkNodes ()
3537
3547
if err != nil && err != channeldb .ErrLinkNodesNotFound {
3538
- return err
3548
+ return fmt . Errorf ( "failed to fetch all link nodes: %w" , err )
3539
3549
}
3550
+
3540
3551
for _ , node := range linkNodes {
3541
3552
pubStr := string (node .IdentityPub .SerializeCompressed ())
3542
3553
nodeAddrs := & nodeAddresses {
@@ -3551,7 +3562,7 @@ func (s *server) establishPersistentConnections() error {
3551
3562
// that have been added via NodeAnnouncement messages.
3552
3563
sourceNode , err := s .graphDB .SourceNode ()
3553
3564
if err != nil {
3554
- return err
3565
+ return fmt . Errorf ( "failed to fetch source node: %w" , err )
3555
3566
}
3556
3567
3557
3568
// TODO(roasbeef): instead iterate over link nodes and query graph for
@@ -3637,8 +3648,15 @@ func (s *server) establishPersistentConnections() error {
3637
3648
nodeAddrsMap [pubStr ] = n
3638
3649
return nil
3639
3650
})
3640
- if err != nil && ! errors .Is (err , graphdb .ErrGraphNoEdgesFound ) {
3641
- return err
3651
+ if err != nil {
3652
+ srvrLog .Errorf ("Failed to iterate channels for node %x" ,
3653
+ sourceNode .PubKeyBytes )
3654
+
3655
+ if ! errors .Is (err , graphdb .ErrGraphNoEdgesFound ) &&
3656
+ ! errors .Is (err , graphdb .ErrEdgeNotFound ) {
3657
+
3658
+ return err
3659
+ }
3642
3660
}
3643
3661
3644
3662
srvrLog .Debugf ("Establishing %v persistent connections on start" ,
0 commit comments