Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions p2p/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,16 @@ func NewHost(cfg HostConfig) (Host, error) {
subLogger.Error().Err(err).Str("addr", addr).Msg("invalid trusted node addr")
continue
}

info, err := libp2p_peer.AddrInfoFromP2pAddr(peerAddr)
if err != nil {
subLogger.Error().Err(err).Str("addr", addr).Msg("failed to parse trusted node")
continue
}
h.trustedPeerIDs[info.ID] = struct{}{}

ps.AddAddrs(info.ID, info.Addrs, libp2p_peerstore.PermanentAddrTTL)
subLogger.Info().Interface("peerAddr", peerAddr).Msg("trusted node added to peerstore")
}

utils.Logger().Info().
Expand Down Expand Up @@ -544,8 +548,6 @@ func (host *HostV2) Start() error {
for _, proto := range host.streamProtos {
proto.Start()
}
// add trusted nodes
host.AddTrustedNodes()
// start discovery
return host.discovery.Start()
}
Expand Down
11 changes: 11 additions & 0 deletions p2p/stream/common/streammanager/streammanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ func (sm *streamManager) discoverAndSetupStream(discCtx context.Context) (int, e
Msg("failed to setup stream with trusted peer")
return
}

sm.logger.Info().
Interface("peerID", pid).
Msg("new stream set up with trusted peer")
}(pid)
}

Expand All @@ -543,6 +547,10 @@ func (sm *streamManager) discoverAndSetupStream(discCtx context.Context) (int, e
if peer.ID == sm.host.ID() {
continue
}
if _, ok := sm.trustedPeers[peer.ID]; ok {
sm.logger.Info().Interface("peer", peer).Msg("skipping trusted peer")
continue
}
if sm.coolDownCache.Has(peer.ID) {
continue
}
Expand All @@ -563,6 +571,9 @@ func (sm *streamManager) discoverAndSetupStream(discCtx context.Context) (int, e
Msg("failed to setup stream with peer")
return
}
sm.logger.Info().
Interface("peerID", pid).
Msg("new stream set up with peer")
}(peer.ID)
}

Expand Down