mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
Log connections (#4143)
* Log connections * Merge branch 'master' into logconnection * Merge branch 'master' into logconnection * Merge branch 'master' into logconnection
This commit is contained in:
parent
0e99e4af4f
commit
646411b881
@ -2,6 +2,7 @@ package p2p
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
@ -15,6 +16,8 @@ import (
|
||||
func (s *Service) AddConnectionHandler(reqFunc func(ctx context.Context, id peer.ID) error) {
|
||||
s.host.Network().Notify(&network.NotifyBundle{
|
||||
ConnectedF: func(net network.Network, conn network.Conn) {
|
||||
multiAddr := fmt.Sprintf("%s/p2p/%s", conn.RemoteMultiaddr().String(), conn.RemotePeer().String())
|
||||
log.WithField("multiAddr", multiAddr).Debug("Connection")
|
||||
if peerstatus.IsBadPeer(conn.RemotePeer()) {
|
||||
// Add Peer to gossipsub blacklist
|
||||
s.pubsub.BlacklistPeer(conn.RemotePeer())
|
||||
|
Loading…
Reference in New Issue
Block a user