diff --git a/cmd/node/main.go b/cmd/node/main.go index 1b042bd55ee..34e971334d9 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -74,6 +74,7 @@ func main() { err := app.Run(os.Args) if err != nil { + log.Error(err.Error()) os.Exit(1) } } diff --git a/p2p/libp2p/discovery/continuousKadDhtDiscoverer.go b/p2p/libp2p/discovery/continuousKadDhtDiscoverer.go index 723f78de8b8..f361fdd97f8 100644 --- a/p2p/libp2p/discovery/continuousKadDhtDiscoverer.go +++ b/p2p/libp2p/discovery/continuousKadDhtDiscoverer.go @@ -2,6 +2,7 @@ package discovery import ( "context" + "errors" "fmt" "sync" "time" @@ -231,10 +232,7 @@ func (ckdd *ContinuousKadDhtDiscoverer) tryConnectToSeeder( initialPeer := initialPeersList[startIndex] err := ckdd.host.ConnectToPeer(ckdd.context, initialPeer) if err != nil { - log.Debug("error connecting to seeder", - "seeder", initialPeer, - "error", err.Error(), - ) + printConnectionErrorToSeeder(initialPeer, err) startIndex++ startIndex = startIndex % len(initialPeersList) select { @@ -253,6 +251,22 @@ func (ckdd *ContinuousKadDhtDiscoverer) tryConnectToSeeder( chanDone <- struct{}{} } +func printConnectionErrorToSeeder(peer string, err error) { + if errors.Is(err, p2p.ErrUnwantedPeer) { + log.Trace("tryConnectToSeeder: unwanted peer", + "seeder", peer, + "error", err.Error(), + ) + + return + } + + log.Debug("error connecting to seeder", + "seeder", peer, + "error", err.Error(), + ) +} + // Name returns the name of the kad dht peer discovery implementation func (ckdd *ContinuousKadDhtDiscoverer) Name() string { return kadDhtName diff --git a/p2p/libp2p/discovery/optimizedKadDhtDiscoverer.go b/p2p/libp2p/discovery/optimizedKadDhtDiscoverer.go index 2b3718b2457..09df8b03b5c 100644 --- a/p2p/libp2p/discovery/optimizedKadDhtDiscoverer.go +++ b/p2p/libp2p/discovery/optimizedKadDhtDiscoverer.go @@ -180,7 +180,7 @@ func (okdd *optimizedKadDhtDiscoverer) tryToReconnectAtLeastToASeeder(ctx contex for _, seederAddress := range okdd.initialPeersList { err := okdd.connectToSeeder(ctx, seederAddress) if err != nil { - log.Debug("error connecting to seeder", "seeder", seederAddress, "error", err.Error()) + printConnectionErrorToSeeder(seederAddress, err) } else { connectedToOneSeeder = true }